So i try to make a selfbot (on my own server) who connect with a real account
import discord
import asyncio
client = discord.Client()
#client.event
async def on_ready():
print(client.servers)
if __name__ == '__main__':
email = input("Enter email: ")
password = input("Enter password: ")
client.login(email, password)
And i've an error : TypeError: login() takes 2 positional arguments but 3 positional arguments (and 1 keyword-only argument) were given
Thanks for helping me
First, You Can't call login method using email and password.
The only way is obtaining token.
How to get token?
Open Chrome Devtools: F12 on Web client or Ctrl+Shift+I on Electron client.
Select Network Tab and Record Network Activity.(Red Circle)
Click any other server, Select `Science` and Go end of Headers
Request Payload Tab - You will find your token.
Make token python variable and DO NOT SHARE CODE OR TOKEN!
Caution
But Beware and Better Not: Selfbot Will Cause Ban you from discord!
Now i have my token i've an error
discord.errors.LoginFailure: Improper token has been passed.
And i'm pretty sure that my token is correct
Related
I am trying to send messages to Facebook friends via Messenger. I found a tutorial & tried it.
import fbchat
from getpass import getpass
username = str(raw_input("Username: "))
client = fbchat.Client(username, getpass())
no_of_friends = int(raw_input("Number of friends: "))
for i in xrange(no_of_friends):
name = str(raw_input("Name: "))
friends = client.getUsers(name) # return a list of names
friend = friends[0]
msg = str(raw_input("Message: "))
sent = client.send(friend.uid, msg)
if sent:
print("Message sent successfully!")
When I ran the program, it requested me my password. And, of course, I entered it. But Facebook doesn't accept the request from my program & lock my Facebook account. I think this is due to security reasons. Then how can I log in to my Facebook from python program without getting locked? Thanks.
This seems like the issue lies with your library, not with you. You should make a new issue at their github page. https://github.com/carpedm20/fbchat
You can selenium to remotely control the browser and do stuff a normal user can do, including logging into facebook.
I am attempting to create a login tool for my work which will log me in to various sites that log me out after 3 minutes of inactivity. I have gotten it to work on a number of sites, but none have required an MFA token. I currently use Google Authenticator but can also use an email, or a couple different options. How would I go about getting that code programmatically to make my login process much faster? I am using Selenium as I need to use the webpage after I log into it. Here is my code thus far:
def loginsys():
driver = webdriver.Chrome('C:/path/to/chromedriver.exe')
driver.get('https://www.specifiedurl.com/login')
username = driver.find_element_by_id('txtUsername')
password = driver.find_element_by_id('txtPassword')
username.send_keys("myusername")
password.send_keys("mypassword")
driver.find_element_by_name('btnLogin').click()
### This is where I need to do MFA as it will not pull the next page without it
driver.get('https://www.specifiedurl.com/page/after/login')
Thoughts? (Obviously, this is not the url, nor is that my actual username or password)
Check the pyotp library. You can get the MFA key associated with google authentication as shown below.
from pyotp import *
# get the token from google authentication
totp = TOTP("your 16 character security token goes here")
token = totp.now()
print (token)
# now you can use token in your script
While running my first code using Telethon library, it is asking for a bot token.
This is the actual code:
from telethon import TelegramClient, events, sync
api_id = 1234567
api_hash = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
client = TelegramClient('anon', api_id, api_hash)
client.start()
And on command prompt:
pip3 install telethon
python3 C:/TG/First.py
Result:
Please enter your phone (or bot token)
If I give my API ID, it eventually throws the error:
telethon.errors.rpcerrorlist.PhoneNumberInvalidError: The phone number is invalid (caused by SendCodeRequest)
Why? I expect the client to start without errors.
PS: my API ID is 7 digits long.
This will only occure at your first use just enter your Phone Number starting with + then you will recive a code which you have to enter next. This is just to Authorise your Laptop beeing loged in to Telegram.
As the error message suggests, your phone number is invalid. Maybe you didn't enter it in international format?
I think you are giving your API ID, but it is asking for your phone number in international format like +91xxxxxxxxxx
Hi I have an issue integrating slack custom bot-user into my slack app, based on python-slackclient documentation python-slackclient
to use the RTM
import time
from slackclient import SlackClient
token = "xoxp-xxxxxxxxx"# found at https://api.slack.com/web#authentication
sc = SlackClient(token)
if sc.rtm_connect():
while True:
print sc.rtm_read()
time.sleep(1)
else:
print "Connection Failed, invalid token?"
that code is working for bot-user token, but since I use oauth, I need to connect RTM using the bot_access_token everytime user install my app to act on behalf my app to the added team
any solution or example how to do it?
Cheers,
Your question is had to understand. You wrote:
since I use oauth, I need to connect RTM using the bot_access_token everytime user install my app to act on behalf my app to the added team
The access token you're using here...
token = "xoxp-xxxxxxxxx"# found at https://api.slack.com/web#authentication
...should be the same as the access token that is associated with your bot. (You should not make your bot use your own personal access token!) You can get an access token for your bot at https://my.slack.com/services/new/bot (assuming you're logged into Slack in the browser with which you follow that link).
If you participate in multiple Slack "teams" (a Slack "team" being basically a company), you'll need to set up a separate bot for each "team". Each bot will have a different access token. To pass the correct access token in to your bot, you could add a command-line parameter, or read the token from an environment variable, or read it from disk, among other options.
You can loop over tokens for connecting if you are planning to setup bot
for multiple teams, then your code can be converted to :-
clients = [SlackClient(token) for t in tokens]
for client in clients:
client.rtm_connect()
while True:
for client in clients:
print client.rtm_read()
time.sleep(1)
I have a piece of code that includes several GET requests. I have a simple if statement to check the status code and provide auth if I receive a status code of 401. How do I avoid having a separate if statement for every single request line I have?
I'd like to be able to provide credentials only once if its protected instead of having to provide it with every single request.
EDIT - Added some code for reference
response = requests.get(self.uri + '/v2/apps')
if (response.status_code == 401):
print("It appears that your marathon instance is protected, please enter your username and password")
usr = input("Username: ")
pwd = getpass.getpass("Password: ")
response = requests.get(self.uri + '/v2/apps', auth=(usr,pwd)).json()
First, if you get a status code of 401, it means you're not authorized to use the resource.
Second, you have different options for authenticating the client once. Usually, I recommend looking into using HTTPS for transporting the data. You can use:
You can use a cookie with expiry
Using a token service in your web server
There multiple authentication standards (e.g. SAML, OAuth, OpenId, etc.) already existing, try not to reinvent the wheel.