mirror of
https://github.com/skidoodle/iphistory.git
synced 2025-02-15 08:29:16 +01:00
Initial commit
This commit is contained in:
commit
9e153ebed3
11 changed files with 1261 additions and 0 deletions
27
genhistory.py
Normal file
27
genhistory.py
Normal file
|
@ -0,0 +1,27 @@
|
|||
import random
|
||||
from datetime import datetime, timedelta
|
||||
import sys
|
||||
|
||||
def generate_example_data(num_entries):
|
||||
data = []
|
||||
for _ in range(num_entries):
|
||||
timestamp = datetime.now() - timedelta(days=random.randint(0, 365),
|
||||
hours=random.randint(0, 23),
|
||||
minutes=random.randint(0, 59),
|
||||
seconds=random.randint(0, 59))
|
||||
ip_address = f"{random.randint(0, 255)}.{random.randint(0, 255)}.{random.randint(0, 255)}.{random.randint(0, 255)}"
|
||||
entry = f"{timestamp.strftime('%Y-%m-%d %H:%M:%S')} CEST - {ip_address}"
|
||||
data.append(entry)
|
||||
return data
|
||||
|
||||
if __name__ == "__main__":
|
||||
if len(sys.argv) != 2:
|
||||
print("Usage: python genhistory.py <num_entries>")
|
||||
sys.exit(1)
|
||||
|
||||
num_entries = int(sys.argv[1])
|
||||
example_data = generate_example_data(num_entries)
|
||||
|
||||
with open('ip_history.txt', 'w') as file:
|
||||
for entry in example_data:
|
||||
file.write(entry + '\n')
|
Loading…
Add table
Add a link
Reference in a new issue