From d140602ad0b3832b2318e61ad5ff80718aecbb40 Mon Sep 17 00:00:00 2001 From: Filippo Date: Thu, 16 May 2019 17:28:08 +0200 Subject: [PATCH 1/5] added -f option: read target IP(s) from file and perform attack --- kickthemout.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/kickthemout.py b/kickthemout.py index 15e7924..4f97909 100644 --- a/kickthemout.py +++ b/kickthemout.py @@ -737,6 +737,17 @@ if __name__ == '__main__': callback=targetList, type='string', dest='targets', help='specify target IP address(es) and perform attack') + + def target_files(option, opt, value, parser): + with open(value) as file: + addr_list = file.readlines() + setattr(parser.values, option.dest, addr_list) + + parser.add_option('-f', '--file', action='callback', + callback=target_files, type='string',metavar='FILE', + dest='targets', help='read target IP address(es) from given file and perform attack') + + (options, argv) = parser.parse_args() try: From 3db187dbce9de3a37bb1dbf1fcdcbe3b31e797e7 Mon Sep 17 00:00:00 2001 From: Filippo Ranza Date: Thu, 16 May 2019 21:15:02 +0200 Subject: [PATCH 2/5] improved help -f help string --- kickthemout.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kickthemout.py b/kickthemout.py index 4f97909..50e6715 100644 --- a/kickthemout.py +++ b/kickthemout.py @@ -745,7 +745,7 @@ if __name__ == '__main__': parser.add_option('-f', '--file', action='callback', callback=target_files, type='string',metavar='FILE', - dest='targets', help='read target IP address(es) from given file and perform attack') + dest='targets', help='read target IP address(es), one per line, from given file and perform attack') (options, argv) = parser.parse_args() From 5574237bfea14c8d342186fd02f21b6edc4e5238 Mon Sep 17 00:00:00 2001 From: Filippo Ranza Date: Thu, 16 May 2019 21:27:03 +0200 Subject: [PATCH 3/5] added -f option example message --- kickthemout.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kickthemout.py b/kickthemout.py index 50e6715..8c9391a 100644 --- a/kickthemout.py +++ b/kickthemout.py @@ -716,6 +716,8 @@ if __name__ == '__main__': ' sudo python3 kickthemout.py --target 192.168.1.10 \n'+ ' sudo python3 kickthemout.py -t 192.168.1.5,192.168.1.10 -p 30\n'+ ' sudo python3 kickthemout.py -s\n'+ + ' sudo python3 kickthemout.py -f ip_list.txt\n'+ + ' sudo python3 kickthemout.py --file ip_list.txt\n' ' sudo python3 kickthemout.py (interactive mode)\n') parser = optparse.OptionParser(epilog=examples, From 4a084a9cac5587baa411c992260664ec0c19818c Mon Sep 17 00:00:00 2001 From: Filippo Ranza Date: Thu, 16 May 2019 21:31:22 +0200 Subject: [PATCH 4/5] added example_ip_list.txt a correct ip list file --- example_ip_list.txt | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 example_ip_list.txt diff --git a/example_ip_list.txt b/example_ip_list.txt new file mode 100644 index 0000000..d95fe99 --- /dev/null +++ b/example_ip_list.txt @@ -0,0 +1,3 @@ +192.168.0.2 +192.168.0.3 +192.168.1.2 \ No newline at end of file From e636ba5fc92afd2b4b8367ab031e0f0e6cdf76a5 Mon Sep 17 00:00:00 2001 From: Filippo Ranza Date: Sat, 18 May 2019 22:55:39 +0200 Subject: [PATCH 5/5] fixed style issues --- example_ip_list.txt | 3 --- kickthemout.py | 13 ++++++------- 2 files changed, 6 insertions(+), 10 deletions(-) delete mode 100644 example_ip_list.txt diff --git a/example_ip_list.txt b/example_ip_list.txt deleted file mode 100644 index d95fe99..0000000 --- a/example_ip_list.txt +++ /dev/null @@ -1,3 +0,0 @@ -192.168.0.2 -192.168.0.3 -192.168.1.2 \ No newline at end of file diff --git a/kickthemout.py b/kickthemout.py index 8c9391a..8d7db31 100644 --- a/kickthemout.py +++ b/kickthemout.py @@ -716,8 +716,7 @@ if __name__ == '__main__': ' sudo python3 kickthemout.py --target 192.168.1.10 \n'+ ' sudo python3 kickthemout.py -t 192.168.1.5,192.168.1.10 -p 30\n'+ ' sudo python3 kickthemout.py -s\n'+ - ' sudo python3 kickthemout.py -f ip_list.txt\n'+ - ' sudo python3 kickthemout.py --file ip_list.txt\n' + ' sudo python3 kickthemout.py -f IPs.txt\n'+ ' sudo python3 kickthemout.py (interactive mode)\n') parser = optparse.OptionParser(epilog=examples, @@ -740,14 +739,14 @@ if __name__ == '__main__': dest='targets', help='specify target IP address(es) and perform attack') - def target_files(option, opt, value, parser): + def targetFiles(option, opt, value, parser): with open(value) as file: - addr_list = file.readlines() - setattr(parser.values, option.dest, addr_list) + addrList = file.readlines() + setattr(parser.values, option.dest, addrList) parser.add_option('-f', '--file', action='callback', - callback=target_files, type='string',metavar='FILE', - dest='targets', help='read target IP address(es), one per line, from given file and perform attack') + callback=targetFiles, type='string', metavar='FILE', + dest='targets', help='read target IP address(es) from line-separated file and perform attack') (options, argv) = parser.parse_args()