inconsistent query results.. (am i missing something)
hi, i'm having what i think is some inconsistencies in the query/query language.. and I just want some clarification..
i have a script (CLI and python) that run once a day to find devices in Louisiana.. and I get very different results depending on how many days I request..
Here are 4 examples of shodan queries:
————————————————————————————————
shodan download ./OneDay --limit -1 "state:LA country:US after:1 days"
Search query: state:LA country:US after:1 days
Total number of results: 2
Query credits left: 1507
Output file: ./OneDay.json.gz
[####################################] 100%
Notice: fewer results were saved than requested
Saved 1 results into file ./OneDay.json.gz
shodan download ./7Days --limit -1 "state:LA country:US after:7 days"
Search query: state:LA country:US after:7 days
Total number of results: 0
Query credits left: 1507
Output file: ./7Days.json.gz
[####################################] 100%
Saved 0 results into file ./7Days.json.gz
shodan download ./30Days --limit -1 "state:LA country:US after:30 days"
Search query: state:LA country:US after:30 days
Total number of results: 2
Query credits left: 1507
Output file: ./30Days.json.gz
[##################------------------] 50% 00:00:09
Saved 2 results into file ./30Days.json.gz
Saved 0 results into file ./7Days.json.gz
#This query will result when it finishes will have 100’s of results for the last 30 days..
Shodan download ./All --limit -1 "state:LA country:US"
Search query: state:LA country:US
Total number of results: 681707
Query credits left: 1507
Output file: ./All.json.gz
[------------------------------------] 0%
I have a simple log of what its done in the last week or two, with results being downloaded.. but when I try to get the last 30 days.. i get 0 results.. what am I missing? is there a better way to query for this?
2024-09-13 20:50:50,731 - shodanPull_v2 Logger - INFO - [+]: Querying Shodan: after:2024-09-10 country:US state:LA
2024-09-13 20:50:59,043 - shodanPull_v2 Logger - INFO - [+]: Results found: 4
2024-09-13 20:50:59,044 - shodanPull_v2 Logger - INFO - [+ Had vulnerability +]: : 70.150.151.171 added to dataStore
2024-09-13 20:50:59,048 - shodanPull_v2 Logger - INFO - [+]: Updated Entry: 70.150.151.171
2024-09-13 20:50:59,048 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.104 not added to data store
2024-09-13 20:50:59,048 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 198.182.205.167 not added to data store
2024-09-13 20:51:03,522 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-13 20:53:57,848 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-13 20:53:59,647 - shodanPull_v2 Logger - INFO - [+]: Querying Shodan: after:2024-09-10 country:US state:LA
2024-09-13 20:54:05,283 - shodanPull_v2 Logger - INFO - [+]: Results found: 4
2024-09-13 20:54:05,284 - shodanPull_v2 Logger - INFO - [+ Had vulnerability +]: : 70.150.151.171 added to dataStore
2024-09-13 20:54:05,287 - shodanPull_v2 Logger - INFO - [+]: Updated Entry: 70.150.151.171
2024-09-13 20:54:05,287 - shodanPull_v2 Logger - INFO - [+ Had vulnerability +]: : 69.45.232.17 added to dataStore
2024-09-13 20:54:05,287 - shodanPull_v2 Logger - INFO - [+]: Updated Entry: 69.45.232.17
2024-09-13 20:54:05,287 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.104 not added to data store
2024-09-13 20:54:05,287 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 198.182.205.167 not added to data store
2024-09-13 20:54:09,843 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-13 20:54:48,217 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-14 00:00:02,032 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-14 00:00:06,250 - shodanPull_v2 Logger - INFO - [+]: Querying Shodan: after:2024-09-11 country:US state:LA
2024-09-14 00:00:10,091 - shodanPull_v2 Logger - INFO - [+]: Results found: 14
2024-09-14 00:00:10,091 - shodanPull_v2 Logger - INFO - [+ Had vulnerability +]: : 69.45.232.20 added to dataStore
2024-09-14 00:00:10,093 - shodanPull_v2 Logger - INFO - [+]: Updated Entry: 69.45.232.20
2024-09-14 00:00:10,093 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.103 not added to data store
2024-09-14 00:00:10,093 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.90 not added to data store
2024-09-14 00:00:10,093 - shodanPull_v2 Logger - INFO - [+ Had vulnerability +]: : 69.45.232.17 added to dataStore
2024-09-14 00:00:10,093 - shodanPull_v2 Logger - INFO - [+]: Updated Entry: 69.45.232.17
2024-09-14 00:00:10,093 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.104 not added to data store
2024-09-14 00:00:10,093 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.15 not added to data store
2024-09-14 00:00:10,093 - shodanPull_v2 Logger - INFO - [+ Had vulnerability +]: : 69.45.232.19 added to dataStore
2024-09-14 00:00:10,094 - shodanPull_v2 Logger - INFO - [+]: Updated Entry: 69.45.232.19
2024-09-14 00:00:10,094 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 198.182.205.167 not added to data store
2024-09-14 00:00:10,094 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 75.147.166.109 not added to data store
2024-09-14 00:00:10,094 - shodanPull_v2 Logger - INFO - [+ Had vulnerability +]: : 69.45.232.18 added to dataStore
2024-09-14 00:00:10,094 - shodanPull_v2 Logger - INFO - [+]: Updated Entry: 69.45.232.18
2024-09-14 00:00:10,094 - shodanPull_v2 Logger - INFO - [+ Had vulnerability +]: : 173.218.180.209 added to dataStore
2024-09-14 00:00:10,094 - shodanPull_v2 Logger - INFO - [+]: Updated Entry: 173.218.180.209
2024-09-14 00:00:10,094 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.101 not added to data store
2024-09-14 00:00:10,094 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.105 not added to data store
2024-09-14 00:00:10,094 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.102 not added to data store
2024-09-14 00:00:14,002 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-15 00:00:02,130 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-15 00:00:02,876 - shodanPull_v2 Logger - INFO - [+]: Querying Shodan: after:2024-09-12 country:US state:LA
2024-09-15 00:00:04,898 - shodanPull_v2 Logger - INFO - [+]: Results found: 4
2024-09-15 00:00:04,898 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.105 not added to data store
2024-09-15 00:00:04,898 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.90 not added to data store
2024-09-15 00:00:04,898 - shodanPull_v2 Logger - INFO - [+ Had vulnerability +]: : 69.45.232.17 added to dataStore
2024-09-15 00:00:04,901 - shodanPull_v2 Logger - INFO - [+]: Updated Entry: 69.45.232.17
2024-09-15 00:00:04,901 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 198.182.205.167 not added to data store
2024-09-15 00:00:08,723 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-16 00:00:01,850 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-16 00:00:03,294 - shodanPull_v2 Logger - INFO - [+]: Querying Shodan: after:2024-09-13 country:US state:LA
2024-09-16 00:00:08,935 - shodanPull_v2 Logger - INFO - [+]: Results found: 3
2024-09-16 00:00:08,935 - shodanPull_v2 Logger - INFO - [+ Had vulnerability +]: : 70.150.151.171 added to dataStore
2024-09-16 00:00:08,937 - shodanPull_v2 Logger - INFO - [+]: Updated Entry: 70.150.151.171
2024-09-16 00:00:08,938 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.103 not added to data store
2024-09-16 00:00:08,938 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 75.147.166.109 not added to data store
2024-09-16 00:00:14,045 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-17 00:00:01,673 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-17 00:00:02,985 - shodanPull_v2 Logger - INFO - [+]: Querying Shodan: after:2024-09-14 country:US state:LA
2024-09-17 00:00:04,542 - shodanPull_v2 Logger - INFO - [+]: Results found: 3
2024-09-17 00:00:04,542 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.103 not added to data store
2024-09-17 00:00:04,542 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.104 not added to data store
2024-09-17 00:00:04,542 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.101 not added to data store
2024-09-17 00:00:09,938 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-18 00:00:02,168 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-18 00:00:03,033 - shodanPull_v2 Logger - INFO - [+]: Querying Shodan: after:2024-09-15 country:US state:LA
2024-09-18 00:00:06,886 - shodanPull_v2 Logger - INFO - [+]: Results found: 2
2024-09-18 00:00:06,886 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.103 not added to data store
2024-09-18 00:00:06,886 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.104 not added to data store
2024-09-18 00:00:12,127 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-19 00:00:01,481 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-19 00:00:02,460 - shodanPull_v2 Logger - INFO - [+]: Querying Shodan: after:2024-09-16 country:US state:LA
2024-09-19 00:00:13,655 - shodanPull_v2 Logger - INFO - [+]: Results found: 8
2024-09-19 00:00:13,655 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.102 not added to data store
2024-09-19 00:00:13,655 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.105 not added to data store
2024-09-19 00:00:13,656 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.103 not added to data store
2024-09-19 00:00:13,656 - shodanPull_v2 Logger - INFO - [+ Had vulnerability +]: : 69.45.232.17 added to dataStore
2024-09-19 00:00:13,660 - shodanPull_v2 Logger - INFO - [+]: Updated Entry: 69.45.232.17
2024-09-19 00:00:13,660 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.104 not added to data store
2024-09-19 00:00:13,660 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.15 not added to data store
2024-09-19 00:00:13,660 - shodanPull_v2 Logger - INFO - [+ Had vulnerability +]: : 173.218.180.209 added to dataStore
2024-09-19 00:00:13,660 - shodanPull_v2 Logger - INFO - [+]: Updated Entry: 173.218.180.209
2024-09-19 00:00:13,660 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.101 not added to data store
2024-09-19 00:00:18,866 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-13 20:50:50,731 - shodanPull_v2 Logger - INFO - [+]: Querying Shodan: after:2024-09-10 country:US state:LA
2024-09-13 20:50:59,043 - shodanPull_v2 Logger - INFO - [+]: Results found: 4
2024-09-13 20:50:59,044 - shodanPull_v2 Logger - INFO - [+ Had vulnerability +]: : 70.150.151.171 added to dataStore
2024-09-13 20:50:59,048 - shodanPull_v2 Logger - INFO - [+]: Updated Entry: 70.150.151.171
2024-09-13 20:50:59,048 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.104 not added to data store
2024-09-13 20:50:59,048 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 198.182.205.167 not added to data store
2024-09-13 20:51:03,522 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-13 20:53:57,848 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-13 20:53:59,647 - shodanPull_v2 Logger - INFO - [+]: Querying Shodan: after:2024-09-10 country:US state:LA
2024-09-13 20:54:05,283 - shodanPull_v2 Logger - INFO - [+]: Results found: 4
2024-09-13 20:54:05,284 - shodanPull_v2 Logger - INFO - [+ Had vulnerability +]: : 70.150.151.171 added to dataStore
2024-09-13 20:54:05,287 - shodanPull_v2 Logger - INFO - [+]: Updated Entry: 70.150.151.171
2024-09-13 20:54:05,287 - shodanPull_v2 Logger - INFO - [+ Had vulnerability +]: : 69.45.232.17 added to dataStore
2024-09-13 20:54:05,287 - shodanPull_v2 Logger - INFO - [+]: Updated Entry: 69.45.232.17
2024-09-13 20:54:05,287 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.104 not added to data store
2024-09-13 20:54:05,287 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 198.182.205.167 not added to data store
2024-09-13 20:54:09,843 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-13 20:54:48,217 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-14 00:00:02,032 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-14 00:00:06,250 - shodanPull_v2 Logger - INFO - [+]: Querying Shodan: after:2024-09-11 country:US state:LA
2024-09-14 00:00:10,091 - shodanPull_v2 Logger - INFO - [+]: Results found: 14
2024-09-14 00:00:10,091 - shodanPull_v2 Logger - INFO - [+ Had vulnerability +]: : 69.45.232.20 added to dataStore
2024-09-14 00:00:10,093 - shodanPull_v2 Logger - INFO - [+]: Updated Entry: 69.45.232.20
2024-09-14 00:00:10,093 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.103 not added to data store
2024-09-14 00:00:10,093 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.90 not added to data store
2024-09-14 00:00:10,093 - shodanPull_v2 Logger - INFO - [+ Had vulnerability +]: : 69.45.232.17 added to dataStore
2024-09-14 00:00:10,093 - shodanPull_v2 Logger - INFO - [+]: Updated Entry: 69.45.232.17
2024-09-14 00:00:10,093 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.104 not added to data store
2024-09-14 00:00:10,093 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.15 not added to data store
2024-09-14 00:00:10,093 - shodanPull_v2 Logger - INFO - [+ Had vulnerability +]: : 69.45.232.19 added to dataStore
2024-09-14 00:00:10,094 - shodanPull_v2 Logger - INFO - [+]: Updated Entry: 69.45.232.19
2024-09-14 00:00:10,094 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 198.182.205.167 not added to data store
2024-09-14 00:00:10,094 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 75.147.166.109 not added to data store
2024-09-14 00:00:10,094 - shodanPull_v2 Logger - INFO - [+ Had vulnerability +]: : 69.45.232.18 added to dataStore
2024-09-14 00:00:10,094 - shodanPull_v2 Logger - INFO - [+]: Updated Entry: 69.45.232.18
2024-09-14 00:00:10,094 - shodanPull_v2 Logger - INFO - [+ Had vulnerability +]: : 173.218.180.209 added to dataStore
2024-09-14 00:00:10,094 - shodanPull_v2 Logger - INFO - [+]: Updated Entry: 173.218.180.209
2024-09-14 00:00:10,094 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.101 not added to data store
2024-09-14 00:00:10,094 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.105 not added to data store
2024-09-14 00:00:10,094 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.102 not added to data store
2024-09-14 00:00:14,002 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-15 00:00:02,130 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-15 00:00:02,876 - shodanPull_v2 Logger - INFO - [+]: Querying Shodan: after:2024-09-12 country:US state:LA
2024-09-15 00:00:04,898 - shodanPull_v2 Logger - INFO - [+]: Results found: 4
2024-09-15 00:00:04,898 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.105 not added to data store
2024-09-15 00:00:04,898 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.90 not added to data store
2024-09-15 00:00:04,898 - shodanPull_v2 Logger - INFO - [+ Had vulnerability +]: : 69.45.232.17 added to dataStore
2024-09-15 00:00:04,901 - shodanPull_v2 Logger - INFO - [+]: Updated Entry: 69.45.232.17
2024-09-15 00:00:04,901 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 198.182.205.167 not added to data store
2024-09-15 00:00:08,723 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-16 00:00:01,850 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-16 00:00:03,294 - shodanPull_v2 Logger - INFO - [+]: Querying Shodan: after:2024-09-13 country:US state:LA
2024-09-16 00:00:08,935 - shodanPull_v2 Logger - INFO - [+]: Results found: 3
2024-09-16 00:00:08,935 - shodanPull_v2 Logger - INFO - [+ Had vulnerability +]: : 70.150.151.171 added to dataStore
2024-09-16 00:00:08,937 - shodanPull_v2 Logger - INFO - [+]: Updated Entry: 70.150.151.171
2024-09-16 00:00:08,938 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.103 not added to data store
2024-09-16 00:00:08,938 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 75.147.166.109 not added to data store
2024-09-16 00:00:14,045 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-17 00:00:01,673 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-17 00:00:02,985 - shodanPull_v2 Logger - INFO - [+]: Querying Shodan: after:2024-09-14 country:US state:LA
2024-09-17 00:00:04,542 - shodanPull_v2 Logger - INFO - [+]: Results found: 3
2024-09-17 00:00:04,542 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.103 not added to data store
2024-09-17 00:00:04,542 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.104 not added to data store
2024-09-17 00:00:04,542 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.101 not added to data store
2024-09-17 00:00:09,938 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-18 00:00:02,168 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-18 00:00:03,033 - shodanPull_v2 Logger - INFO - [+]: Querying Shodan: after:2024-09-15 country:US state:LA
2024-09-18 00:00:06,886 - shodanPull_v2 Logger - INFO - [+]: Results found: 2
2024-09-18 00:00:06,886 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.103 not added to data store
2024-09-18 00:00:06,886 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.104 not added to data store
2024-09-18 00:00:12,127 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-19 00:00:01,481 - shodanPull_v2 Logger - INFO - --===========================================--
2024-09-19 00:00:02,460 - shodanPull_v2 Logger - INFO - [+]: Querying Shodan: after:2024-09-16 country:US state:LA
2024-09-19 00:00:13,655 - shodanPull_v2 Logger - INFO - [+]: Results found: 8
2024-09-19 00:00:13,655 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.102 not added to data store
2024-09-19 00:00:13,655 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.105 not added to data store
2024-09-19 00:00:13,656 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.103 not added to data store
2024-09-19 00:00:13,656 - shodanPull_v2 Logger - INFO - [+ Had vulnerability +]: : 69.45.232.17 added to dataStore
2024-09-19 00:00:13,660 - shodanPull_v2 Logger - INFO - [+]: Updated Entry: 69.45.232.17
2024-09-19 00:00:13,660 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.104 not added to data store
2024-09-19 00:00:13,660 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.15 not added to data store
2024-09-19 00:00:13,660 - shodanPull_v2 Logger - INFO - [+ Had vulnerability +]: : 173.218.180.209 added to dataStore
2024-09-19 00:00:13,660 - shodanPull_v2 Logger - INFO - [+]: Updated Entry: 173.218.180.209
2024-09-19 00:00:13,660 - shodanPull_v2 Logger - INFO - [- No Vulnerability -]: : 199.19.233.101 not added to data store
2024-09-19 00:00:18,866 - shodanPull_v2 Logger - INFO - --===========================================--
@dmille6 is after a valid Shodan filter? If it is, I would assume that you would need to wrap x days in quotes.
I don't see it in the official Shodan filter reference: https://www.shodan.io/search/filters
🤔
@rmhowe425
this seems to work: (bash script)
current_date=$(date +"%Y-%m-%d")
yesterday=$(date -d "yesterday" '+%Y-%m-%d')
# Define the output filename
output_filename="louisiana-events-$current_date.json.gz"
# Run the Shodan download command for Louisiana events in the last 30 days
shodan download ./daily/$output_filename --limit -1 "state:LA country:US after:$yesterday"
so we'll give this a try. using a specific date is working.. not sure what happened to the "1 days".. "2 days".. it worked and was consistent for years..
@dmille6
Have you been able to figure this out? Having looked at the bash script above, it appears to not be working. I cannot get the "after" filter to work for the life of me. It is rather confusing as the Shodan web search states that this filter is only supported via the API, but at the same is not listed with all the filters on the API documentation page as @rmhowe425 pointed out previously.
this seems to work.. over 30 days it does not.. I think the data is archived in a different way.. but under 30 days this seems to work:
#!/bin/bash
cd /etc/shodan_cli
# Get the current date in YYYY-MM-DD format
current_date=$(date +"%Y-%m-%d")
yesterday=$(date -d "yesterday" '+%Y-%m-%d')
two_days_ago=$(date -d "2 days ago" '+%Y-%m-%d')
# Define the output filename
output_filename="louisiana-events-$current_date.json.gz"
# Run the Shodan download command for Louisiana events in the last 48 hours
shodan download ./daily/$output_filename --limit -1 "state:LA country:US after:$yesterday"
# unzip archive
cd ./daily
gzip -d *.gz