コード例 #1
0
def connScan(tgtHost, tgtPort):  # Note: Does the port scanning
    try:
        sock = socket(AF_INET, SOCK_STREAM)
        sock.connect((tgtHost, tgtPort))
        print(clrd(f"[+] Port {tgtPort} for tcp is Open", 'green'))
    except:
        print(clrd(f"[-] Port {tgtPort} for tcp is Closed", 'red'))
    finally:
        sock.close()
コード例 #2
0
def ftpSniff(pkt):
    dest = pkt.getlayer(scapy.IP).dst
    raw = pkt.sprintf("%Raw.load%")
    usr = re.findall("(?i)USER (.*)", raw)
    pswd = re.findall("(?i)PASS (.*)", raw)
    if usr:
        print(clrd(f"[*] Detected FTP Login To {str(dest)}", 'white'))
        print(clrd(f"[+] User Account: {str(usr[0])}", 'white'))
    elif pswd:
        print(clrd(f"[+] Password: {str(pswd[0])}", 'white'))
コード例 #3
0
def Main():
  app = linkedin_helpers.authenticate()
  groups = app.get_memberships(params={'count': 100})
  if groups['_total'] > 0:
    selected = random.randint(0, groups['_total'] - 1)

    print "You're subscribed to " + clrd(groups['_total'], 'green') + " groups."
    print "The last posts of the " + clrd(groups['values'][selected]['group']['name'], 'blue') + \
      " group (randomly selected) will be analyzed."
    analyze_group(app, groups['values'][selected])
  else:
    print "You aren't in any group. This ends here."
コード例 #4
0
def file_status(passList):
    global passFile
    try:
        passFile = open(passList, "r")
    except:
        print(clrd("File doesn't exist in this path.", "blue"))
        exit(0)
コード例 #5
0
def main():
    parser = argp.ArgumentParser(description="Usage of program: " +
                                 "-H <target host> -p <target port>")
    parser.add_argument("-H",
                        "--Host",
                        dest="tgtHost",
                        metavar="",
                        required=True,
                        help="Specify Target Host.")
    parser.add_argument(
        "-p",
        "--Port",
        dest="tgtPort",
        metavar="",
        required=True,
        help="Specify Target Port for multiple ports separate by comma.")
    options = parser.parse_args()
    tgtHost = options.tgtHost
    tgtPorts = str(options.tgtPort).split(",")

    if (tgtHost == None) | (tgtPorts[0] == None):
        print(clrd(parser.usage, 'cyan'))
        # Note: Outputs "Usage of program: -H <target host> -p <target port>" if no parameters attached
        exit(0)
    portScan(tgtHost, tgtPorts)
コード例 #6
0
def checkVulns(
        banner,
        filename):  #Compares vulnerability defined in filename to banner
    fn = open(filename, "rb")
    for line in fn.readlines():
        if line in banner:  #strip seems to be a problem
            print(
                clrd("[++] Server is vulnerable: " + banner.decode("utf-8"),
                     "red"))
コード例 #7
0
def bruteLogin(ip_address, loginfile): #hostname or ip address and the file to use
    try:
        pfile = open(loginfile, "r")
        for line in pfile.readlines():
            userName = line.split(":")[0]
            pswd = line.split(":")[1].strip("\n")
            print (clrd(f"[@] Trying {userName}:{pswd}.", "blue"))
            try:
                ftp = ftplib.FTP(ip_address)
                ftp.login(userName, pswd)
                print (clrd(f"[+] {userName}:{pswd} FTP Login Succeeded.", "green"))
                pfile.close()
                ftp.quit()
                return(userName, pswd) #So it doesn't print the not in list if successful
            except Exception as e:
                #print (clrd(f"[-] {userName}:{pswd} FTP Login Failed.", "red"))
                pass
        print (clrd(f"[-] Username / Password Combination not in list.", "red"))
    except:
        print (clrd(f"[!] The file {loginfile} doesn't exist!", "red"))
コード例 #8
0
ファイル: basic.py プロジェクト: igncp/leaves
def Main():
  max_length = 10
  discogs = discogs_helpers.authenticate()
  keywords = raw_input('Type some keyworks to search by: ')
  if keywords is '':
    keywords = 'Big Star'
    print 'No keywords were typed. Using "{}" by default.'.format(keywords)
  results = discogs.search(keywords, type='release')
  print 'Number of results: ' + clrd(str(results.count), 'green')
  if results.count > max_length:
    releases = DataFrame(columns=['release', 'title', 'artists', 'year'])
    for num in range(max_length):
      release = results[num]
      artists = ', '.join([artist.name for artist in release.artists])
      releases.loc[num] = [release.id, release.title, artists, release.year]
    generate_bar_plot(releases)
  else:
    print 'As there are less than 10 results, nothing will be done.'
コード例 #9
0
def Main():
    max_length = 10
    discogs = discogs_helpers.authenticate()
    keywords = raw_input('Type some keyworks to search by: ')
    if keywords is '':
        keywords = 'Big Star'
        print 'No keywords were typed. Using "{}" by default.'.format(keywords)
    results = discogs.search(keywords, type='release')
    print 'Number of results: ' + clrd(str(results.count), 'green')
    if results.count > max_length:
        releases = DataFrame(columns=['release', 'title', 'artists', 'year'])
        for num in range(max_length):
            release = results[num]
            artists = ', '.join([artist.name for artist in release.artists])
            releases.loc[num] = [
                release.id, release.title, artists, release.year
            ]
        generate_bar_plot(releases)
    else:
        print 'As there are less than 10 results, nothing will be done.'
コード例 #10
0
def main():
    parser = argp.ArgumentParser(description="Usage of program: " +
                                 "-i <interface>")
    parser.add_argument("-i",
                        "--interface",
                        dest="interface",
                        metavar="",
                        required=True,
                        help="Specify Interface to Listen From.")
    options = parser.parse_args()

    if (options.interface == None):
        print(clrd(parser.usage, 'cyan'))
        exit(0)
    else:
        conf.iface = options.interface

    try:
        sniff(filter="tcp port 21", prn=ftpSniff)
    except KeyboardInterrupt:
        exit(0)
コード例 #11
0
def main():
    if len(sys.argv) == 2:  #requires 2 arguements
        filename = sys.argv[1]  #python starts at 0, 1
        if not os.path.isfile(filename):  #if the file doesn't exist
            print("[-] File Doesn't Exist!")
            exit(0)
        if not os.access(filename, os.R_OK):  #if higher privilege is needed
            print("[-] Access Denied.")
            exit(0)
    else:
        print(f"[-] Usage: {str(sys.argv[0])} <vuln filename>"
              )  #if no argument shows this when running
        exit(0)

    portlist = []
    ip = input("[*] Enter Target IP: ")
    portlist = [port for port in input("[*] Enter Target Port: ").split(",")
                ]  #list comprehension for multiple port inputs
    for port in portlist:
        banner = returnBan(ip, int(port))
        if banner:
            print(clrd(f"[+] {ip}:{port} : " + banner.decode("utf-8"),
                       'green'))
            checkVulns(banner, filename)
コード例 #12
0
 #! Requires MD5 hash and passwordlist.txt
 # Note: given a MD5 hash and a passwordlist it will hash the list of passwords till it matches the MD5 hash

import hashlib
from termcolor import colored as clrd #Import color text to the output, not neccessary but helps easily seeing the data

def file_status(passList):
    global passFile
    try:
        passFile = open(passList, "r")
    except:
        print(clrd("File doesn't exist in this path.", "blue"))
        exit(0)

md5hash = input("[*] Enter a MD5 Hash Value: ")
passList = input("[*] Enter the path of the password list: ")

file_status(passList)
for p in passFile:
    print(clrd(f"[-] Trying Password: {str(p.strip())} doesn't match, continuing...", "red"))
    enc_pass = p.encode("utf-8")
    hashGuess = hashlib.md5(enc_pass.strip()).hexdigest()

    if hashGuess == md5hash:
        print(clrd(f"[+] The password is: {str(p)}", "green"))
        passFile.close() #don't need as the exit would do the same thing
        exit(0)

print(clrd(f"[-] Password doesn't exist in list.", "red"))
コード例 #13
0
ファイル: apis_helpers.py プロジェクト: igncp/leaves
def save_fig(plt, directory, name):
    filepath = 'reports/APIs/' + directory
    if not os.path.isdir(filepath): os.makedirs(filepath)
    filepath += '/' + name + '.png'
    plt.savefig(filepath)
    print 'A chart was created at ' + clrd(filepath, 'green')
コード例 #14
0
# ! https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Common-Credentials/10-million-password-list-top-100000.txt
# Note: Hashes password from list above using SHA1 and then tries to match to a given SHA1 hash value
# Note: If known SHA1 hash can try to match to a given list of passwords then hash them and try to match

from urllib.request import urlopen
import hashlib
from termcolor import colored as clrd  #Import color text to the output, not neccessary but helps easily seeing the data

sha1hash = input("[*] Enter a SHA1 Hash Value: ")
passList = str(
    urlopen(
        "https://raw.githubusercontent.com/danielmiessler/SecLists/master/Passwords/Common-Credentials/10-million-password-list-top-100000.txt"
    ).read(), "utf-8")

for p in passList.split("\n"):
    hashGuess = hashlib.sha1(bytes(p, "utf-8")).hexdigest()
    if hashGuess == sha1hash:
        print(clrd(f"[+] The password is: {str(p)}", "green"))
        quit()
    else:
        print(
            clrd(f"[-] Password: {str(p)} doesn't match guess, continuing...",
                 "red"))
print(clrd("Password doesn't exist in this list", "orange"))