Skip to content

Commit bc1369f

Browse files
authored
Merge pull request #9 from louigigr/win-autodays_patch
Win autodays patch
2 parents 37ce908 + 3ea0418 commit bc1369f

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,8 +28,11 @@ e.g. ``` abuseipdb -f alert.log ```
2828

2929
> Optional: To save to a file you can apend > {filename} after the command e.g ``` abuseipdb -f alert.log > ThreatReport.txt ```
3030
31-
- Specify the number of days you wish to search and display alerts for.
31+
- Specify the number of days you wish to search and display alerts for by using the -d or --days switch.
32+
e.g. ``` abuseipdb -f myip.txt -d 60 ```
33+
3234
- Accepted range is 1 to 365
35+
- If no switch is specified the script uses a default value of _30_
3336
- Contains a really simple failsafe so the script won't break, really helps with the binary version
3437
- To get help type abuseipdb -h
3538

@@ -63,6 +66,8 @@ python3 abuseipdb.py -f file_to_parse.txt
6366
-t outputs items in tab seperated values (Default)
6467
6568
-c outputs items in comma seperated values
69+
70+
-d specifies number of days
6671
```
6772

6873

abuseipdb.py

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,18 @@ def get_reg(name):
5454
help="parses IP Addresses from a single given file",
5555
action="store",
5656
required=False)
57-
# required.add_argument(
58-
# "-d",
59-
# "--days",
60-
# help="Number of days to look back in history for alerts",
61-
# action="store",
62-
# required=False)
57+
required.add_argument(
58+
"-d",
59+
"--days",
60+
help="Number of days to look back in history for alerts",
61+
action="store",
62+
required=False)
6363

6464

6565
parser.add_argument("-t", "--tsv", help="outputs items in tab seperated values (Default)", action="store_true")
6666
parser.add_argument("-c", "--csv", help="outputs items in comma seperated values", action="store_true")
6767
parser.add_argument("-a", dest="APIKEY", help="stores new API key in registry", action="store")
68-
# parser.add_argument("-d", dest="DAYS", help="Number of days to look back in history for alerts", action="store")
68+
#parser.add_argument("-d", dest="DAYS", help="Number of days to look back in history for alerts", action="store")
6969

7070
args = parser.parse_args()
7171

@@ -105,7 +105,11 @@ def get_cat(x):
105105

106106

107107
def get_report(IP):
108-
noofdays=input("Please enter number of days to look back in history for alerts: ")
108+
if not args.days:
109+
print("Setting days to default: 30")
110+
noofdays = 30
111+
else:
112+
noofdays=args.days
109113
try:
110114
val=int(noofdays)
111115
except ValueError:
@@ -114,6 +118,7 @@ def get_report(IP):
114118
if (int(noofdays) <= int(0) or int(noofdays) > int(365)):
115119
print("\nYou must specify an integer between 1 and 365.\n")
116120
sys.exit()
121+
117122
#request = 'https://www.abuseipdb.com/check/%s/json?key=%s&days=%s' % (IP, api_key, str(argv[4]))
118123
request = 'https://www.abuseipdb.com/check/%s/json?key=%s&days=%s' % (IP, api_key, noofdays)
119124
# DEBUG

0 commit comments

Comments
 (0)