ID2T should notify the user before generating, if there is no free space on disk.
This can be achieved by assuming the resulting .pcap size based on the original .pcap size and the estimated amount of generated packets.
At the very least it should not crash.
Crash if disk fills up during writing the result pcap:
$ ./id2t -i resources/201804041400.pcap -a SMBScan -T
Input file: resources/201804041400.pcap
Label file found. Loading labels...
Read 0 label(s) successfully.
Located statistics database at: /home/pepper-jk/.cache/id2t/db/186/185/9289ccfd2840.sqlite3
Loaded file statistics in 0.00 sec from statistics database.
Creating attack instance of SMBScanAttack
Validating and adding attack parameters.
Generating attack packets... done. (total: 1000 pkts in 339.02553367614746 seconds.)
POST INJECTION STATISTICS SUMMARY --------------------------
Total packet count: 78330145 packets
Added packet count: 1000 packets
Share of added packets: 0.0013 %
Capture duration: 0.4295 seconds
------------------------------------------------------------
Merging base pcap with single attack pcap... Could not serialize base packet with timestamp 1522818221.90773
Could not serialize base packet with timestamp 1522818300.36396
Could not serialize base packet with timestamp 1522818389.45844
Could not serialize base packet with timestamp 1522818389.65043
Could not serialize base packet with timestamp 1522818467.90078
Could not serialize base packet with timestamp 1522818497.87013
Could not serialize base packet with timestamp 1522818565.43478
Could not serialize base packet with timestamp 1522818565.72621
Could not serialize base packet with timestamp 1522818565.72621
Could not serialize base packet with timestamp 1522818565.72626
done.
Deleting intermediate attack pcap... done.
Traceback (most recent call last):
File "/home/pepper-jk/code/ID2T-toolkit/code/CLI.py", line 189, in <module>
main(sys.argv[1:])
File "/home/pepper-jk/code/ID2T-toolkit/code/CLI.py", line 184, in main
cli.parse_arguments(args)
File "/home/pepper-jk/code/ID2T-toolkit/code/CLI.py", line 84, in parse_arguments
self.process_arguments()
File "/home/pepper-jk/code/ID2T-toolkit/code/CLI.py", line 95, in process_arguments
self.process_pcap()
File "/home/pepper-jk/code/ID2T-toolkit/code/CLI.py", line 166, in process_pcap
controller.process_attacks(self.args.attack, self.args.rngSeed, self.args.time, self.args.inject_empty)
File "/home/pepper-jk/code/ID2T-toolkit/code/Core/Controller.py", line 158, in process_attacks
self.label_manager.write_label_file(self.pcap_dest_path)
File "/home/pepper-jk/code/ID2T-toolkit/code/Core/LabelManager.py", line 171, in write_label_file
file.close()
OSError: [Errno 28] No space left on device
Crash on start with no free disk space left:
$ ./id2t -i resources/201804041400.pcap -T -a SMBScan target.count=30000 hosting.percentage=0.02
Input file: resources/201804041400.pcap
Label file found. Loading labels...
Read 0 label(s) successfully.
Located statistics database at: /home/pepper-jk/.cache/id2t/db/186/185/9289ccfd2840.sqlite3
Loaded file statistics in 0.00 sec from statistics database.
Creating attack instance of SMBScanAttack
Traceback (most recent call last):
File "/home/pepper-jk/code/ID2T-toolkit/code/CLI.py", line 189, in <module>
main(sys.argv[1:])
File "/home/pepper-jk/code/ID2T-toolkit/code/CLI.py", line 184, in main
cli.parse_arguments(args)
File "/home/pepper-jk/code/ID2T-toolkit/code/CLI.py", line 84, in parse_arguments
self.process_arguments()
File "/home/pepper-jk/code/ID2T-toolkit/code/CLI.py", line 95, in process_arguments
self.process_pcap()
File "/home/pepper-jk/code/ID2T-toolkit/code/CLI.py", line 166, in process_pcap
controller.process_attacks(self.args.attack, self.args.rngSeed, self.args.time, self.args.inject_empty)
File "/home/pepper-jk/code/ID2T-toolkit/code/Core/Controller.py", line 89, in process_attacks
temp_attack_pcap, duration = self.attack_controller.process_attack(attack[0], attack[1:], time)
File "/home/pepper-jk/code/ID2T-toolkit/code/Core/AttackController.py", line 139, in process_attack
self.create_attack(attack, self.seed)
File "/home/pepper-jk/code/ID2T-toolkit/code/Core/AttackController.py", line 116, in create_attack
self.current_attack.set_statistics(self.statistics)
File "/home/pepper-jk/code/ID2T-toolkit/code/Attack/BaseAttack.py", line 79, in set_statistics
self.most_used_ttl_value = self.statistics.get_most_used_ttl_value()
File "/home/pepper-jk/code/ID2T-toolkit/code/Core/Statistics.py", line 619, in get_most_used_ttl_value
return self.process_db_query("SELECT ttlValue FROM (SELECT ttlValue, SUM(ttlCount) as occ FROM ip_ttl GROUP BY "
File "/home/pepper-jk/code/ID2T-toolkit/code/Core/Statistics.py", line 803, in process_db_query
return self.stats_db.process_db_query(query_string_in, print_results)
File "/home/pepper-jk/code/ID2T-toolkit/code/Core/StatsDatabase.py", line 329, in process_db_query
result = self.process_user_defined_query(query_string, sql_query_parameters)
File "/home/pepper-jk/code/ID2T-toolkit/code/Core/StatsDatabase.py", line 137, in process_user_defined_query
self.cursor.execute(query_string)
sqlite3.OperationalError: database or disk is full
ID2T should notify the user before generating, if there is no free space on disk.
This can be achieved by assuming the resulting .pcap size based on the original .pcap size and the estimated amount of generated packets.
At the very least it should not crash.
Crash if disk fills up during writing the result pcap:
$ ./id2t -i resources/201804041400.pcap -a SMBScan -T
Input file: resources/201804041400.pcap
Label file found. Loading labels...
Read 0 label(s) successfully.
Located statistics database at: /home/pepper-jk/.cache/id2t/db/186/185/9289ccfd2840.sqlite3
Loaded file statistics in 0.00 sec from statistics database.
Creating attack instance of SMBScanAttack
Validating and adding attack parameters.
Generating attack packets... done. (total: 1000 pkts in 339.02553367614746 seconds.)
POST INJECTION STATISTICS SUMMARY --------------------------
Total packet count: 78330145 packets
Added packet count: 1000 packets
Share of added packets: 0.0013 %
Capture duration: 0.4295 seconds
------------------------------------------------------------
Merging base pcap with single attack pcap... Could not serialize base packet with timestamp 1522818221.90773
Could not serialize base packet with timestamp 1522818300.36396
Could not serialize base packet with timestamp 1522818389.45844
Could not serialize base packet with timestamp 1522818389.65043
Could not serialize base packet with timestamp 1522818467.90078
Could not serialize base packet with timestamp 1522818497.87013
Could not serialize base packet with timestamp 1522818565.43478
Could not serialize base packet with timestamp 1522818565.72621
Could not serialize base packet with timestamp 1522818565.72621
Could not serialize base packet with timestamp 1522818565.72626
done.
Deleting intermediate attack pcap... done.
Traceback (most recent call last):
File "/home/pepper-jk/code/ID2T-toolkit/code/CLI.py", line 189, in <module>
main(sys.argv[1:])
File "/home/pepper-jk/code/ID2T-toolkit/code/CLI.py", line 184, in main
cli.parse_arguments(args)
File "/home/pepper-jk/code/ID2T-toolkit/code/CLI.py", line 84, in parse_arguments
self.process_arguments()
File "/home/pepper-jk/code/ID2T-toolkit/code/CLI.py", line 95, in process_arguments
self.process_pcap()
File "/home/pepper-jk/code/ID2T-toolkit/code/CLI.py", line 166, in process_pcap
controller.process_attacks(self.args.attack, self.args.rngSeed, self.args.time, self.args.inject_empty)
File "/home/pepper-jk/code/ID2T-toolkit/code/Core/Controller.py", line 158, in process_attacks
self.label_manager.write_label_file(self.pcap_dest_path)
File "/home/pepper-jk/code/ID2T-toolkit/code/Core/LabelManager.py", line 171, in write_label_file
file.close()
OSError: [Errno 28] No space left on device
Crash on start with no free disk space left:
$ ./id2t -i resources/201804041400.pcap -T -a SMBScan target.count=30000 hosting.percentage=0.02
Input file: resources/201804041400.pcap
Label file found. Loading labels...
Read 0 label(s) successfully.
Located statistics database at: /home/pepper-jk/.cache/id2t/db/186/185/9289ccfd2840.sqlite3
Loaded file statistics in 0.00 sec from statistics database.
Creating attack instance of SMBScanAttack
Traceback (most recent call last):
File "/home/pepper-jk/code/ID2T-toolkit/code/CLI.py", line 189, in <module>
main(sys.argv[1:])
File "/home/pepper-jk/code/ID2T-toolkit/code/CLI.py", line 184, in main
cli.parse_arguments(args)
File "/home/pepper-jk/code/ID2T-toolkit/code/CLI.py", line 84, in parse_arguments
self.process_arguments()
File "/home/pepper-jk/code/ID2T-toolkit/code/CLI.py", line 95, in process_arguments
self.process_pcap()
File "/home/pepper-jk/code/ID2T-toolkit/code/CLI.py", line 166, in process_pcap
controller.process_attacks(self.args.attack, self.args.rngSeed, self.args.time, self.args.inject_empty)
File "/home/pepper-jk/code/ID2T-toolkit/code/Core/Controller.py", line 89, in process_attacks
temp_attack_pcap, duration = self.attack_controller.process_attack(attack[0], attack[1:], time)
File "/home/pepper-jk/code/ID2T-toolkit/code/Core/AttackController.py", line 139, in process_attack
self.create_attack(attack, self.seed)
File "/home/pepper-jk/code/ID2T-toolkit/code/Core/AttackController.py", line 116, in create_attack
self.current_attack.set_statistics(self.statistics)
File "/home/pepper-jk/code/ID2T-toolkit/code/Attack/BaseAttack.py", line 79, in set_statistics
self.most_used_ttl_value = self.statistics.get_most_used_ttl_value()
File "/home/pepper-jk/code/ID2T-toolkit/code/Core/Statistics.py", line 619, in get_most_used_ttl_value
return self.process_db_query("SELECT ttlValue FROM (SELECT ttlValue, SUM(ttlCount) as occ FROM ip_ttl GROUP BY "
File "/home/pepper-jk/code/ID2T-toolkit/code/Core/Statistics.py", line 803, in process_db_query
return self.stats_db.process_db_query(query_string_in, print_results)
File "/home/pepper-jk/code/ID2T-toolkit/code/Core/StatsDatabase.py", line 329, in process_db_query
result = self.process_user_defined_query(query_string, sql_query_parameters)
File "/home/pepper-jk/code/ID2T-toolkit/code/Core/StatsDatabase.py", line 137, in process_user_defined_query
self.cursor.execute(query_string)
sqlite3.OperationalError: database or disk is full
ID2T should notify the user before generating, if there is no free space on disk.
This can be achieved by assuming the resulting .pcap size based on the original .pcap size and the estimated amount of generated packets.
At the very least it should not crash.
Crash if disk fills up during writing the result pcap:
Crash on start with no free disk space left: