Skip to content

Instantly share code, notes, and snippets.

@matt-bernhardt
Forked from gravesm/potemkin.py
Last active April 9, 2018 20:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save matt-bernhardt/7603891 to your computer and use it in GitHub Desktop.
Save matt-bernhardt/7603891 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
from __future__ import print_function
import json
import sys
from datetime import timedelta, datetime
from random import randint, choice
countries = ('004','008','010','012','016','020','024','028','031','032','036','040','044','048','050','051','052','056','060','064','068','070','072','074','076','084','086','090','092','096','100','104','108','112','116','120','124','132','136','140','144','148','152','156','158','162','166','170','174','175','178','180','184','188','191','192','196','203','204','208','212','214','218','222','226','231','232','233','234','238','239','242','246','248','250','254','258','260','262','266','268','270','275','276','288','292','296','300','304','308','312','316','320','324','328','332','334','336','340','344','348','352','356','360','364','368','372','376','380','384','388','392','398','400','404','408','410','414','417','418','422','426','428','430','434','438','440','442','446','450','454','458','462','466','470','474','478','480','484','492','496','498','499','500','504','508','512','516','520','524','528','531','533','534','535','540','548','554','558','562','566','570','574','578','580','581','583','584','585','586','591','598','600','604','608','612','616','620','624','626','630','634','638','642','643','646','652','654','659','660','662','663','666','670','674','678','682','686','688','690','694','702','703','704','705','706','710','716','724','728','729','732','740','744','748','752','756','760','762','764','768','772','776','780','784','788','792','795','796','798','800','804','807','818','826','831','832','833','834','840','850','854','858','860','862','876','882','887','894',)
dlc = ('Bates Linear Accelerator Center','Broad Institute of MIT and Harvard','Broad Institute - Microbial Analysis Group','Broad Institute - Stanley Center for Psychiatric Research','Charles Stark Draper Laboratory','David H. Koch Institute for Integrative Cancer Research at MIT','Francis Bitter National Magnet Laboratory','Harvard-MIT Division of Health Sciences and Technology','Harvard-MIT Speech and Hearing Bioscience and Technology Program','Harvard-MIT Center for Ultracold Atoms','Haystack Observatory','Howard Hughes Medical Institute','Institute for Medical Engineering and Science','Joint Program in Chemical Oceanography','Joint Program in Oceanography/Applied Ocean Science and Engineering','Laser Interferometer Gravitational-Wave Observatory','Lincoln Laboratory','Lincoln Laboratory. Intelligence and Decision Technologies Group','Ludwig Center for Molecular Oncology','Aerospace Biomedical and Life Support Engineering','Aerospace Controls Laboratory','Anthropology Program','Auto-ID Laboratory','BioInstrumentation Laboratory','Building Technology Program','Center for Biological and Computational Learning','Center for Biomedical Engineering','Center for Biomedical Innovation','Center for Cancer Research','Center for Collective Intelligence','Center for Computational Engineering','Center for Electromagnetic Theory and Applications','Center for Environmental Health Sciences','Center for Global Change Science','Center for International Studies','Center for Materials Science and Engineering','Center for Ocean Engineering','Center for Real Estate','Center for Technology, Policy, and Industrial Development','Center for Theoretical Physics','Center for Transportation & Logistics','Communications Futures Program','Community Innovators Laboratory (CoLab)','Computational and Systems Biology Program','Computer Science and Artificial Intelligence Laboratory','Dept. of Aeronautics and Astronautics','Dept. of Architecture','Dept. of Biological Engineering','Dept. of Biology','Dept. of Brain and Cognitive Sciences','Dept. of Chemical Engineering','Dept. of Chemistry','Dept. of Chemistry. Instrumentation Facility','Dept. of Civil and Environmental Engineering','Dept. of Earth, Atmospheric, and Planetary Sciences','Dept. of Economics','Dept. of Electrical Engineering and Computer Science','Dept. of Linguistics and Philosophy','Dept. of Materials Science and Engineering','Dept. of Mathematics','Dept. of Mechanical Engineering','Dept. of Nuclear Science and Engineering','Dept. of Physics','Dept. of Political Science','Dept. of Urban Studies and Planning','Division of Comparative Medicine','Earth Resources Laboratory','Engineering Systems Division','Experimental Study Group','Foreign Languages and Literatures','Glenn Laboratory for the Science of Aging','High Voltage Research Laboratory','Humans and Automation Lab','Institute for Soldier Nanotechnologies','Intelligent Transportation Research Center','Joint Program on the Science & Policy of Global Change','Laboratory for Atomistic and Molecular Mechanics','Laboratory for Computational Cell Biology & Biophysics','Laboratory for Computational Physiology','Laboratory for Computer Science','Laboratory for Electrochemical Interfaces','Laboratory for Electromagnetic and Electronic Systems','Laboratory for Financial Engineering','Laboratory for Human and Machine Haptics','Laboratory for Information and Decision Systems','Laboratory for Manufacturing and Productivity','Laboratory for Nuclear Science','Laser Biomedical Research Center','Lemelson-MIT Awards Program','Libraries','Man-Vehicle Laboratory','Materials Processing Center','Materials Systems Laboratory','Media Laboratory','Media Laboratory. Design Ecology Group','Media Laboratory. Human Dynamics Research Group','Media Laboratory. Responsive Environments Group','Medical Department','Microphotonics Center','Microsystems Technology Laboratories','Music and Theater Arts Section','Nonlinear Systems Laboratory','Office of Educational Innovation and Technology','Office of the Dean for Undergraduate Education','Office of the Provost','Open Learning Enterprise','Operations Research Center','Personal Robots Group','Plasma Science and Fusion Center','Police','Program in Art, Culture and Technology','Program in History, Anthropology, and Science, Technology, and Society','Program in Polymer Science and Technology','Program in Science, Technology and Society','Research Laboratory of Electronics','Research Laboratory of Electronics. Digital Signal Processing Group','Responsive Environments Group','School of Architecture and Planning','School of Humanities, Arts, and Social Sciences','School of Science','Sea Grant College Program','Security Studies Program','SENSEable City Laboratory','Signals, Information and Algorithms Laboratory','Singapore-MIT Alliance in Research and Technology (SMART)','Spectroscopy Laboratory','Woods Hole Oceanographic Institution. Joint Program','Writing Across the Curriculum Program','Center for Theoretical Physics','Research Laboratory of Electronics','McGovern Institute for Brain Research at MIT','MIT Center for Digital Business','MIT Center for Future Civic Media','MIT Energy Initiative','MIT Experimental Study Group','MIT Nuclear Reactor Laboratory','MIT Program in Writing & Humanistic Studies','MIT School of Science','MIT Teaching and Learning Laboratory','Picower Institute for Learning and Memory','Ragon Institute of MGH, MIT and Harvard','RIKEN-MIT Center for Neural Circuit Genetics','Singapore-MIT Alliance','Sloan School of Management','Sloan School of Management. Technological Innovation, Entrepreneurship, and Strategic Management Group','System Design and Management Program','Whitaker College of Health Sciences and Technology','Whitehead Institute for Biomedical Research',)
user_agents = ('Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Ubuntu Chromium/30.0.1599.114 Chrome/30.0.1599.114 Safari/537.36',)
def random_date(start, end):
delta = randint(0, int((end - start).total_seconds()))
return start + timedelta(seconds=delta)
def create_request():
request = {}
request['ip_address'] = '18.1.1.1'
request['time'] = random_date(datetime(2009, 1, 1), datetime.now()).isoformat()
request['request'] = 'http://example.com/id/{}'.format(randint(0, 100))
request['status'] = 200
request['referer'] = "http://example.com/"
request['user_agent'] = choice(user_agents)
request['dlc'] = choice(dlc)
request['author'] = "http://example.com/author/{}".format(randint(1000, 1200))
request['handle'] = "http://example.com/handle/{}".format(randint(0,100))
request['country'] = choice(countries)
return request
if __name__ == "__main__":
requests = sys.argv[1]
for i in range(0, int(requests)):
print(json.dumps(create_request()))
@matt-bernhardt
Copy link
Author

Adding more country and DLC options, to make mapping calculations slightly more complex and the visuals more interesting

@matt-bernhardt
Copy link
Author

Switched country codes over to the numeric variant, added "real" list of DLC options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment