Path: blob/master/SMSend-Anon-SMS-Sender/smsend.py
1291 views
import requests1from stem import Signal2from stem.control import Controller3import time4import subprocess5import os67class Colors:8RED = '\033[31m'9GREEN = '\033[32m'10YELLOW = '\033[33m'11BLUE = '\033[34m'12MAGENTA = '\033[35m'13CYAN = '\033[36m'14WHITE = '\033[37m'15RESET = '\033[0m'161718def Intro():19print(f"""{Colors.GREEN}20⠀⠀⠀⠀⠀⠀⠀⢰⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣤⣀⠀⠀⠀⠀⠀⠀⠀21⠀⠀⠀⠀⠀⠀⠀⢀⠙⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠿⠀⠀⠀⠀⠀⠀⠀22⠀⠀⠀⠀⠀⠀⠀⠀⣷⣶⣤⣄⣈⣉⣉⣉⣉⣉⣉⣉⣁⣤⡄⠀⠀⠀⠀⠀⠀⠀23⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀24⠀⠀⠀⠀⠀⠀⠀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀25⠀⠀⠀⠀⠀⠀⢀⠀⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡇⠀⠀⠀⠀⠀⠀⠀26⠀⠀⢀⣠⣶⣾⡏⢀⡈⠛⠻⠿⢿⣿⣿⣿⣿⣿⠿⠿⠟⠛⢁⠀⢶⣤⣀⠀⠀⠀27⠀⢠⣿⣿⣿⣿⡇⠸⣿⣿⣶⣶⣤⣤⣤⣤⣤⣤⣤⣶⣶⣿⡿⠂⣸⣿⣿⣷⡄⠀28⠀⢸⣿⣿⣿⣿⣿⣦⣄⡉⠛⠛⠛⠿⠿⠿⠿⠛⠛⠛⢉⣁⣤⣾⣿⣿⣿⣿⡷⠀29⠀⠀⠙⢿⣿⣿⣿⣿⣿⣿⣿⣷⣶⣶⣶⣶⣶⣶⣾⣿⣿⣿⣿⣿⣿⣿⡿⠛⠁⠀30⠀⠀⠀⠀⠈⠙⠛⠿⠿⢿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠿⠿⠿⠛⠛⠉⠁⠀⠀⠀⠀31⢀⡤⠤⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀⠤⢤⡀32⣾⡁⠀⠀⠀⠀⠀⠀⠀⠀⢀⣠⣴⣶⣤⣤⣶⣦⣄⡀⠀⠀⠀⠀⠀⠀⠀⠀⢈⣷33⢿⣧⡀⠀⠀⠀⢀⣀⣴⣾⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣦⣀⡀⠀⠀⠀⢀⣼⡿34⠈⠻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⡿⠋⠙⢿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⠟⠁35⠀⠀⠈⠙⠛⠛⠛⠛⠛⠛⠛⠉⠁⠀⠀⠀⠀⠈⠉⠛⠛⠛⠛⠛⠛⠛⠋⠁⠀⠀36{Colors.RESET}37- SMSend -38{Colors.BLUE} By Sytaxus and nu11secur1ty: debugging plus development / cmdSNR {Colors.RESET}39Instructions: This tool may {Colors.RED} limitations{Colors.RESET}.40- In regards to questions, open an issue in the GitHub repo41- Check the https://github.com/sytaxus/SMSend-Anon-SMS-Sender/, for full documentation if stuck.42- Check the https://github.com/nu11secur1ty/Kali-Linux/tree/master/SMSend-Anon-SMS-Sender, for plugins43""")4445def cls_scrn():46if os.name == 'nt':47_ = os.system('cls')48else:49os.system('clear')5051def connect_vpn_proton(config_path, username, password):52try:53with open('vpn_auth.txt', 'w') as auth_file:54auth_file.write(f"{username}\n{password}\n")55os.chmod('vpn_auth.txt', 0o600)5657process = subprocess.Popen(58['sudo', 'openvpn', '--config', config_path, '--auth-user-pass', 'vpn_auth.txt', '--auth-nocache'],59stdout=subprocess.DEVNULL,60)61time.sleep(5)62return process63except Exception as e:64print(f"Failed to connect to VPN: {e}")65return None6667def check_connectivity(ip='8.8.8.8'):68try:69subprocess.check_output(['ping', '-c', '4', ip])70return True71except subprocess.CalledProcessError:72print('No internet connection available..\n')73return False747576def disconnect_vpn_proton():77subprocess.run(['sudo', 'pkill', 'openvpn'])78time.sleep(5)79808182def request_sms(phone, message):83try:84resp = requests.post('https://textbelt.com/text', {85'phone': phone,86'message': message,87'key': 'textbelt',88})89print(resp.json() if resp.status_code == 200 else f"HTTP Error {resp.status_code}: {resp.text}")90finally:91print('Finished.\n - SMSend. - nu11secur1ty.\n')929394def multi_sms(vpn_directory, file_name_phone_num, message):95print("NOTE: EACH PHONE NUMBER WILL BE USING 1 VPN. Example: If you have 2 phone numbers in the file name and 1 .ovpn file in the vpn directory, then only ONE SMS will be sent.")9697if not check_connectivity():98print("No internet connection available before VPN connection. Aborting operation.\n")99return100101credentials_file = input('Enter the VPN credentials file name: ')102try:103with open(credentials_file, 'r') as file:104username = file.readline().strip()105password = file.readline().strip()106107with open(file_name_phone_num, 'r') as file:108phone_numbers = [line.strip() for line in file if line.strip()]109110print(f"Searching for VPN configs in: {vpn_directory}")111vpn_files = [os.path.join(vpn_directory, f) for f in os.listdir(vpn_directory) if f.lower().endswith('.ovpn')]112113if not vpn_files:114print("No VPN configuration files found in the directory.\n")115return116117print(f"Found {len(vpn_files)} VPN config file(s).")118119if len(vpn_files) < len(phone_numbers):120print(f"Warning: Not enough VPN configs for the number of phone numbers. Only the first {len(vpn_files)} numbers will be sent.\n")121answ = input('Do you want to proceed with the available VPNs? (Y/n): ').lower()122if answ == 'n':123print("Operation aborted.\n")124return125phone_numbers = phone_numbers[:len(vpn_files)]126127for phone, vpn in zip(phone_numbers, vpn_files):128print(f"Sending SMS to {phone} using VPN config {vpn}")129if connect_vpn_proton(vpn, username, password) is not None:130if check_connectivity():131request_sms(phone, message)132print('SMS sent....\n')133else:134print("Internet connection lost after VPN connection. Aborting SMS send.\n")135disconnect_vpn_proton()136else:137print(f"Failed to connect using {vpn}, skipping...\n")138139except Exception as e:140print(f"An error occurred in multi_sms: {e}\n")141142def Begin():143cls_scrn()144Intro()145try:146available_choices = input(f'{Colors.BLUE}SELECT BY NUMBER:{Colors.RESET}\n1. Send ONE SMS.\n2. Send MULTIPLE SMS. (VPNs config required.)\n\nChoose > ')147message = input('Your custom message (LINKS ARE NOT ALLOWED DUE TO API limitations.): ')148149if available_choices == '1':150region = input('Enter phone region/prefix (For example +1 for US/Canada): ')151phone_no_prefix = input('Enter phone number (Not Prefix Included): ')152check = []153154http_detected = 0155o = message.split()156for i in o:157if 'http' in i or '.com' in i:158http_detected += 1159160for i in region:161check.append(i)162if len(check) > 3:163print('Country prefix invalid! (Cannot exceed 3 characters.)')164elif http_detected >= 1:165print('Links are not allowed due to free api limitations.')166else:167full_number = region + phone_no_prefix168request_sms(full_number,message)169elif available_choices == '2':170vpn_directory = input('Enter PATH to VPN config files directory: ')171file_name = input('Enter file name with phone numbers. (ONE NUMBER PER LINE INCLUDING PREFIX, EX: +15555555555): ')172multi_sms(vpn_directory,file_name,message)173174except Exception as e:175print(f'Invalid. Error: {e}\n')176177if __name__ == "__main__":178Begin()179180181