|
5 | 5 | Faraday Penetration Test IDE |
6 | 6 | Copyright (C) 2013 Infobyte LLC (http://www.infobytesec.com/) |
7 | 7 | See the file 'doc/LICENSE' for the license information |
8 | | -
|
9 | 8 | ''' |
10 | | -import re |
| 9 | + |
11 | 10 | import os |
12 | | -import pprint |
13 | | -import sys |
14 | 11 | import argparse |
15 | | -import shlex |
16 | 12 |
|
17 | 13 | if __name__ == '__main__': |
18 | | - parser = argparse.ArgumentParser() |
19 | | - |
20 | | - # executes received code |
21 | | - parser.add_argument('-e') |
22 | | - # where to store fplugin's output |
23 | | - parser.add_argument('-o') |
| 14 | + description = ( |
| 15 | + 'Using our plugin you can do different actions in the command line' |
| 16 | + ' and interact with Faraday. Faraday comes with some presets for bulk' |
| 17 | + ' actions such as object removal, get object information, etc.') |
| 18 | + |
| 19 | + parser = argparse.ArgumentParser(description=description) |
| 20 | + |
| 21 | + parser.add_argument( |
| 22 | + '-e', |
| 23 | + '--execute', |
| 24 | + help='Execute code received in this parameter.' |
| 25 | + ' Example:\n./fplugin -e "for h in api.__model_controller.getAllHosts(): print h.name"') |
| 26 | + |
| 27 | + parser.add_argument( |
| 28 | + '-o', |
| 29 | + '--output', |
| 30 | + help='Store output of fplugin in a file.') |
| 31 | + |
24 | 32 | # file with code to execute |
25 | | - parser.add_argument('-f') |
26 | | - |
27 | | - #get all hosts |
28 | | - #./fplugin -e 'for h in api.__model_controller.getAllHosts(): print h.name' |
29 | | - #create a new host |
30 | | - #./fplugin -e 'for h in api.createAndAddHost("8.8.8.8","Linux")' |
31 | | - #get all creds |
32 | | - #get all hostname |
33 | | - #get all ip port http/https |
| 33 | + parser.add_argument( |
| 34 | + '-f', |
| 35 | + '--file', |
| 36 | + help='File with code to execute.' |
| 37 | + ' Example:\n./fplugin -f getAllIps.py ') |
34 | 38 |
|
35 | 39 | args, unknown = parser.parse_known_args() |
36 | | - |
37 | | - if args.o: |
38 | | - if os.path.isfile(args.o): |
39 | | - with open(args.o) as f: |
| 40 | + if args.output: |
| 41 | + if os.path.isfile(args.output): |
| 42 | + with open(args.output) as f: |
40 | 43 | data = f.read() |
41 | 44 | print data |
42 | | - |
43 | | - |
|
0 commit comments