Skip to content

Commit

Permalink
Adding -debug flag
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Mar 26, 2015
1 parent 957ab85 commit ff6a318
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 0 deletions.
7 changes: 7 additions & 0 deletions examples/psexec.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import sys
import os
import cmd
import logging

from impacket import version
from impacket.smbconnection import *
Expand Down Expand Up @@ -407,6 +408,7 @@ def run(self):
parser.add_argument('-c', action='store',metavar = "pathname", help='copy the filename for later execution, arguments are passed in the command option')
parser.add_argument('-path', action='store', help='path of the command to execute')
parser.add_argument('-file', action='store', help="alternative RemCom binary (be sure it doesn't require CRT)")
parser.add_argument('-debug', action='store_true', help='Turn DEBUG output ON')

group = parser.add_argument_group('authentication')

Expand All @@ -421,6 +423,11 @@ def run(self):

options = parser.parse_args()

if options.debug is True:
logging.getLogger().setLevel(logging.DEBUG)
else:
logging.getLogger().setLevel(logging.INFO)

import re
domain, username, password, address = re.compile('(?:(?:([^/@:]*)/)?([^@:]*)(?::([^@]*))?@)?(.*)').match(options.target).groups('')

Expand Down
7 changes: 7 additions & 0 deletions examples/samrdump.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import string
import sys
import types
import logging

from impacket import uuid, version
from impacket.nt_errors import STATUS_MORE_ENTRIES
Expand Down Expand Up @@ -166,6 +167,7 @@ def __fetchList(self, rpctransport):

parser.add_argument('target', action='store', help='[[domain/]username[:password]@]<targetName or address>')
parser.add_argument('protocol', choices=SAMRDump.KNOWN_PROTOCOLS.keys(), nargs='?', default='445/SMB', help='transport protocol (default 445/SMB)')
parser.add_argument('-debug', action='store_true', help='Turn DEBUG output ON')

group = parser.add_argument_group('authentication')

Expand All @@ -180,6 +182,11 @@ def __fetchList(self, rpctransport):

options = parser.parse_args()

if options.debug is True:
logging.getLogger().setLevel(logging.DEBUG)
else:
logging.getLogger().setLevel(logging.INFO)

import re

domain, username, password, address = re.compile('(?:(?:([^/@:]*)/)?([^@:]*)(?::([^@]*))?@)?(.*)').match(options.target).groups('')
Expand Down
7 changes: 7 additions & 0 deletions examples/services.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import sys
import types
import argparse
import logging
from impacket import uuid, ntlm, version
from impacket.dcerpc.v5 import transport, scmr
from impacket.dcerpc.v5.ndr import NULL
Expand Down Expand Up @@ -256,6 +257,7 @@ def doStuff(self, rpctransport):
parser = argparse.ArgumentParser(add_help = True, description = "Windows Service manipulation script.")

parser.add_argument('target', action='store', help='[[domain/]username[:password]@]<targetName or address>')
parser.add_argument('-debug', action='store_true', help='Turn DEBUG output ON')
subparsers = parser.add_subparsers(help='actions', dest='action')

# A start command
Expand Down Expand Up @@ -310,6 +312,11 @@ def doStuff(self, rpctransport):

options = parser.parse_args()

if options.debug is True:
logging.getLogger().setLevel(logging.DEBUG)
else:
logging.getLogger().setLevel(logging.INFO)

import re
domain, username, password, address = re.compile('(?:(?:([^/@:]*)/)?([^@:]*)(?::([^@]*))?@)?(.*)').match(options.target).groups('')

Expand Down
6 changes: 6 additions & 0 deletions examples/smbclient.py
Original file line number Diff line number Diff line change
Expand Up @@ -443,6 +443,7 @@ def main():

parser.add_argument('target', action='store', help='[[domain/]username[:password]@]<targetName or address>')
parser.add_argument('-file', type=argparse.FileType('r'), help='input file with commands to execute in the mini shell')
parser.add_argument('-debug', action='store_true', help='Turn DEBUG output ON')

group = parser.add_argument_group('authentication')

Expand All @@ -457,6 +458,11 @@ def main():

options = parser.parse_args()

if options.debug is True:
logging.getLogger().setLevel(logging.DEBUG)
else:
logging.getLogger().setLevel(logging.INFO)

import re
domain, username, password, address = re.compile('(?:(?:([^/@:]*)/)?([^@:]*)(?::([^@]*))?@)?(.*)').match(options.target).groups('')

Expand Down
8 changes: 8 additions & 0 deletions examples/smbexec.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import string
import time
import ConfigParser
import logging
from threading import Thread

from impacket import version, smbserver
Expand Down Expand Up @@ -292,6 +293,8 @@ def send_data(self, data):
parser.add_argument('target', action='store', help='[[domain/]username[:password]@]<targetName or address>')
parser.add_argument('-share', action='store', default = 'C$', help='share where the output will be grabbed from (default C$)')
parser.add_argument('-mode', action='store', choices = {'SERVER','SHARE'}, default='SHARE', help='mode to use (default SHARE, SERVER needs root!)')
parser.add_argument('-debug', action='store_true', help='Turn DEBUG output ON')

parser.add_argument('protocol', choices=CMDEXEC.KNOWN_PROTOCOLS.keys(), nargs='?', default='445/SMB', help='transport protocol (default 445/SMB)')

group = parser.add_argument_group('authentication')
Expand All @@ -308,6 +311,11 @@ def send_data(self, data):

options = parser.parse_args()

if options.debug is True:
logging.getLogger().setLevel(logging.DEBUG)
else:
logging.getLogger().setLevel(logging.INFO)

import re
domain, username, password, address = re.compile('(?:(?:([^/@:]*)/)?([^@:]*)(?::([^@]*))?@)?(.*)').match(options.target).groups('')

Expand Down
6 changes: 6 additions & 0 deletions examples/wmiquery.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,7 @@ def do_exit(self, line):
parser.add_argument('target', action='store', help='[[domain/]username[:password]@]<targetName or address>')
parser.add_argument('-namespace', action='store', default='//./root/cimv2', help='namespace name (default //./root/cimv2)')
parser.add_argument('-file', type=argparse.FileType('r'), help='input file with commands to execute in the WQL shell')
parser.add_argument('-debug', action='store_true', help='Turn DEBUG output ON')

group = parser.add_argument_group('authentication')

Expand All @@ -131,6 +132,11 @@ def do_exit(self, line):

options = parser.parse_args()

if options.debug is True:
logging.getLogger().setLevel(logging.DEBUG)
else:
logging.getLogger().setLevel(logging.INFO)

import re
domain, username, password, address = re.compile('(?:(?:([^/@:]*)/)?([^@:]*)(?::([^@]*))?@)?(.*)').match(options.target).groups('')

Expand Down

0 comments on commit ff6a318

Please sign in to comment.