mirror of https://gitlab.com/bashrc2/epicyon
Merge branch 'main' of ssh://code.freedombone.net:2222/bashrc/epicyon
commit
c73fbaec5f
10
city.py
10
city.py
|
|
@ -245,17 +245,17 @@ def spoofGeolocation(baseDir: str,
|
|||
# The city radius value is in longitude and the reference
|
||||
# is Manchester. Adjust for the radius of the chosen city.
|
||||
if areaKm2 > 1:
|
||||
manRadius = math.sqrt(630 / math.pi)
|
||||
manRadius = math.sqrt(1276 / math.pi)
|
||||
radius = math.sqrt(areaKm2 / math.pi)
|
||||
cityRadius = manCityRadius * manRadius / radius
|
||||
cityRadiusDeg = (radius / manRadius) * manCityRadius
|
||||
else:
|
||||
cityRadius = manCityRadius
|
||||
cityRadiusDeg = manCityRadius
|
||||
# Get the position within the city, with some randomness added
|
||||
latitude += \
|
||||
distanceFromCityCenter * cityRadius * \
|
||||
distanceFromCityCenter * cityRadiusDeg * \
|
||||
math.cos(angleRadians)
|
||||
longitude += \
|
||||
distanceFromCityCenter * cityRadius * \
|
||||
distanceFromCityCenter * cityRadiusDeg * \
|
||||
math.sin(angleRadians)
|
||||
longval = longitude
|
||||
if longdirection == 'W':
|
||||
|
|
|
|||
|
|
@ -607,11 +607,11 @@ class PubServer(BaseHTTPRequestHandler):
|
|||
self.send_header('Cookie', cookieStr)
|
||||
self.send_header('Host', callingDomain)
|
||||
self.send_header('InstanceID', self.server.instanceId)
|
||||
# self.send_header('X-Robots-Tag',
|
||||
# 'noindex, nofollow, noarchive, nosnippet')
|
||||
self.send_header('X-Robots-Tag',
|
||||
'noindex, nofollow, noarchive, nosnippet')
|
||||
self.send_header('X-Clacks-Overhead', 'GNU Natalie Nguyen')
|
||||
# self.send_header('Cache-Control', 'public')
|
||||
# self.send_header('Referrer-Policy', 'origin')
|
||||
self.send_header('Cache-Control', 'public')
|
||||
self.send_header('Referrer-Policy', 'origin')
|
||||
self.send_header('Accept-Ranges', 'none')
|
||||
|
||||
def _set_headers(self, fileFormat: str, length: int, cookie: str,
|
||||
|
|
|
|||
7704
locations.txt
7704
locations.txt
File diff suppressed because it is too large
Load Diff
|
|
@ -13,3 +13,14 @@ SAN JOSE, USA: 121.988W,37.408, 121.924W,37.452, 121.951W,37.498, 121.992W,37
|
|||
OAKLAND, USA: 121.988W,37.408, 121.924W,37.452, 121.951W,37.498, 121.992W,37.505, 122.056W,37.54, 122.077W,37.578, 122.098W,37.618, 122.131W,37.637, 122.189W,37.706, 122.227W,37.775, 122.279W,37.798, 122.315W,37.802, 122.291W,37.832, 122.309W,37.902, 122.382W,37.915, 122.368W,37.927, 122.514W,37.882, 122.473W,37.83, 122.481W,37.788, 122.394W,37.796, 122.384W,37.729, 122.4W,37.688, 122.382W,37.654, 122.406W,37.637, 122.392W,37.612, 122.356W,37.586, 122.332W,37.586, 122.275W,37.529, 122.228W,37.488, 122.181W,37.482, 122.134W,37.48, 122.128W,37.471, 122.122W,37.448, 122.095W,37.428, 122.07W,37.413, 122.036W,37.402, 122.035W,37.421
|
||||
SAN FRANCISCO, USA: 121.988W,37.408, 121.924W,37.452, 121.951W,37.498, 121.992W,37.505, 122.056W,37.54, 122.077W,37.578, 122.098W,37.618, 122.131W,37.637, 122.189W,37.706, 122.227W,37.775, 122.279W,37.798, 122.315W,37.802, 122.291W,37.832, 122.309W,37.902, 122.382W,37.915, 122.368W,37.927, 122.514W,37.882, 122.473W,37.83, 122.481W,37.788, 122.394W,37.796, 122.384W,37.729, 122.4W,37.688, 122.382W,37.654, 122.406W,37.637, 122.392W,37.612, 122.356W,37.586, 122.332W,37.586, 122.275W,37.529, 122.228W,37.488, 122.181W,37.482, 122.134W,37.48, 122.128W,37.471, 122.122W,37.448, 122.095W,37.428, 122.07W,37.413, 122.036W,37.402, 122.035W,37.421
|
||||
SAN FRANCISCO, USA: 122.446W,37.794, 122.511W,37.778, 122.51W,37.771, 122.454W,37.775, 122.452W,37.766, 122.510W,37.763, 122.506W,37.735, 122.498W,37.733, 122.496W,37.729, 122.491W,37.729, 122.475W,37.73, 122.474W,37.72, 122.484W,37.72, 122.485W,37.703, 122.495W,37.702, 122.493W,37.679, 122.486W,37.667, 122.492W,37.664, 122.493W,37.629, 122.456W,37.625, 122.450W,37.617, 122.455W,37.621, 122.41W,37.586, 122.383W,37.561, 122.335W,37.509, 122.655W,37.48, 122.67W,37.9, 122.272W,37.93, 122.294W,37.801, 122.448W,37.804
|
||||
SEATTLE, USA: 122.247W,47.918, 122.39W,47.802, 122.389W,47.769, 122.377W,47.758, 122.371W,47.726, 122.379W,47.706, 122.4W,47.696, 122.405W,47.673, 122.416W,47.65, 122.414W,47.642, 122.391W,47.632, 122.373W,47.633, 122.336W,47.602, 122.288W,47.501, 122.299W,47.503, 122.386W,47.592, 122.412W,47.574, 122.394W,47.549, 122.388W,47.507, 122.35W,47.481, 122.365W,47.459, 122.33W,47.406, 122.323W,47.392, 122.321W,47.346, 122.441W,47.302, 122.696W,47.085, 122.926W,47.066, 122.929W,48.383
|
||||
SEATTLE, USA: 122.267W,47.758, 122.29W,47.471, 122.272W,47.693, 122.256W,47.672, 122.278W,47.652, 122.29W,47.583, 122.262W,47.548, 122.265W,47.52, 122.218W,47.498, 122.194W,47.501, 122.193W,47.55, 122.173W,47.58, 122.22W,47.617, 122.238W,47.617, 122.239W,47.637, 122.2W,47.644, 122.207W,47.703, 122.22W,47.705, 122.231W,47.699, 122.255W,47.751
|
||||
SEATTLE, USA: 122.347W,47.675, 122.344W,47.681, 122.337W,47.685, 122.324W,47.679, 122.331W,47.677, 122.34W,47.669, 122.34W,47.664, 122.348W,47.665
|
||||
SEATTLE, USA: 122.423W,47.669, 122.345W,47.641, 122.34W,47.625, 122.327W,47.626, 122.274W,47.64, 122.268W,47.654, 122.327W,47.654, 122.336W,47.647, 122.429W,47.684
|
||||
BRISTOL, ENGLAND: 2.59W,51.449, 2.608W,51.45, 2.62W,51.448, 2.626W,51.461, 2.614W,51.471, 2.615W,51.484, 2.635W,51.471, 2.651W,51.484, 2.653W,51.491, 2.589W,51.518, 2.688W,51.52, 2.686W,51.362, 2.632W,51.404, 2.627W,51.421, 2.61W,51.43, 2.62W,51.439, 2.614W,51.444, 2.598W,51.445
|
||||
BRISTOL, ENGLAND: 2.572W,51.479, 2.559W,51.493, 2.554W,51.496, 2.512W,51.496, 2.524W,51.486, 2.551W,51.472
|
||||
BOSTON, USA: 70.773W,42.238, 70.964W,42.22, 70.997W,42.258, 71.055W,42.303, 71.049W,42.333, 71.038W,42.344, 71.101W,42.406, 71.046W,42.389, 70.993W,42.404, 70.991W,42.418, 71.021W,42.433, 71.012W,42.444, 70.917W,42.47, 70.891W,42.494, 70.934W,42.56, 70.88W,42.549, 70.762W,42.575
|
||||
BOSTON, USA: 71.12W,42.358, 71.107W,42.354, 71.079W,42.363, 71.071W,42.372, 71.06W,42.365, 71.067W,42.365, 71.072W,42.355, 71.094W,42.348, 71.115W,42.35
|
||||
BOSTON, USA: 71.128W,42.425, 71.127W,42.459, 71.088W,42.471, 71.069W,42.44
|
||||
BOSTON, USA: 71.147W,42.364, 71.16W,42.386, 71.162W,42.405, 71.149W,42.424, 71.154W,42.432, 71.17W,42.439, 71.164W,42.447, 71.154W,42.436, 71.145W,42.446, 71.141W,42.442, 71.144W,42.437, 71.142W,42.424, 71.148W,42.406, 71.139W,42.386, 71.139W,42.374, 71.125W,42.363
|
||||
CAIRO, EGYPT: 31.148E,30.15, 31.177E,30.133, 31.209E,30.121, 31.225E,30.091, 31.22E,30.075, 31.211E,30.065, 31.218E,30.039, 31.215E,30.012, 31.212E,29.999, 31.216E,29.991, 31.214E,29.977, 31.266E,29.936, 31.275E,29.911, 31.286E,29.854, 31.286E,29.831, 31.285E,29.78, 31.294E,29.776, 31.298E,29.801, 31.296E,29.84, 31.292E,29.864, 31.288E,29.893, 31.284E,29.926, 31.273E,29.944, 31.238E,29.973, 31.228E,29.999, 31.223E,30.019, 31.228E,30.034, 31.233E,30.045, 31.227E,30.071, 31.244E,30.106, 31.236E,30.125, 31.221E,30.132, 31.183E,30.14, 31.164E,30.149, 31.143E,30.172, 31.106E,30.242
|
||||
|
|
|
|||
113
tests.py
113
tests.py
|
|
@ -3626,11 +3626,13 @@ def testSpoofGeolocation() -> None:
|
|||
citiesList = [
|
||||
'NEW YORK, USA:40.7127281:W74.0060152:784',
|
||||
'LOS ANGELES, USA:34.0536909:W118.242766:1214',
|
||||
'SAN FRANCISCO, USA:37.74594738515095:W122.44299445520019:121',
|
||||
'HOUSTON, USA:29.6072:W95.1586:1553',
|
||||
'MANCHESTER, ENGLAND:53.4794892:W2.2451148:630',
|
||||
'MANCHESTER, ENGLAND:53.4794892:W2.2451148:1276',
|
||||
'BERLIN, GERMANY:52.5170365:13.3888599:891',
|
||||
'ANKARA, TURKEY:39.93:32.85:24521',
|
||||
'LONDON, ENGLAND:51.5073219:W0.1276474:1738'
|
||||
'LONDON, ENGLAND:51.5073219:W0.1276474:1738',
|
||||
'SEATTLE, USA:47.59840153253106:W122.31143714060059:217'
|
||||
]
|
||||
testSquare = [
|
||||
[[0.03, 0.01], [0.02, 10], [10.01, 10.02], [10.03, 0.02]]
|
||||
|
|
@ -3740,6 +3742,113 @@ def testSpoofGeolocation() -> None:
|
|||
str(coords[0]) + ',0</coordinates>\n'
|
||||
kmlStr += ' </Point>\n'
|
||||
kmlStr += '</Placemark>\n'
|
||||
|
||||
nogoLine = \
|
||||
'SAN FRANCISCO, USA: 121.988W,37.408, 121.924W,37.452, ' + \
|
||||
'121.951W,37.498, 121.992W,37.505, 122.056W,37.54, ' + \
|
||||
'122.077W,37.578, 122.098W,37.618, 122.131W,37.637, ' + \
|
||||
'122.189W,37.706, 122.227W,37.775, 122.279W,37.798, ' + \
|
||||
'122.315W,37.802, 122.291W,37.832, 122.309W,37.902, ' + \
|
||||
'122.382W,37.915, 122.368W,37.927, 122.514W,37.882, ' + \
|
||||
'122.473W,37.83, 122.481W,37.788, 122.394W,37.796, ' + \
|
||||
'122.384W,37.729, 122.4W,37.688, 122.382W,37.654, ' + \
|
||||
'122.406W,37.637, 122.392W,37.612, 122.356W,37.586, ' + \
|
||||
'122.332W,37.586, 122.275W,37.529, 122.228W,37.488, ' + \
|
||||
'122.181W,37.482, 122.134W,37.48, 122.128W,37.471, ' + \
|
||||
'122.122W,37.448, 122.095W,37.428, 122.07W,37.413, ' + \
|
||||
'122.036W,37.402, 122.035W,37.421'
|
||||
polygon = parseNogoString(nogoLine)
|
||||
nogoLine2 = \
|
||||
'SAN FRANCISCO, USA: 122.446W,37.794, 122.511W,37.778, ' + \
|
||||
'122.51W,37.771, 122.454W,37.775, 122.452W,37.766, ' + \
|
||||
'122.510W,37.763, 122.506W,37.735, 122.498W,37.733, ' + \
|
||||
'122.496W,37.729, 122.491W,37.729, 122.475W,37.73, ' + \
|
||||
'122.474W,37.72, 122.484W,37.72, 122.485W,37.703, ' + \
|
||||
'122.495W,37.702, 122.493W,37.679, 122.486W,37.667, ' + \
|
||||
'122.492W,37.664, 122.493W,37.629, 122.456W,37.625, ' + \
|
||||
'122.450W,37.617, 122.455W,37.621, 122.41W,37.586, ' + \
|
||||
'122.383W,37.561, 122.335W,37.509, 122.655W,37.48, ' + \
|
||||
'122.67W,37.9, 122.272W,37.93, 122.294W,37.801, ' + \
|
||||
'122.448W,37.804'
|
||||
polygon2 = parseNogoString(nogoLine2)
|
||||
nogoList = [polygon, polygon2]
|
||||
for i in range(1000):
|
||||
dayNumber = randint(10, 30)
|
||||
hour = randint(1, 23)
|
||||
hourStr = str(hour)
|
||||
if hour < 10:
|
||||
hourStr = '0' + hourStr
|
||||
currTime = datetime.datetime.strptime("2021-05-" + str(dayNumber) +
|
||||
" " + hourStr + ":14",
|
||||
"%Y-%m-%d %H:%M")
|
||||
coords = spoofGeolocation('', 'SAN FRANCISCO, USA', currTime,
|
||||
decoySeed, citiesList, nogoList)
|
||||
longitude = coords[1]
|
||||
if coords[3] == 'W':
|
||||
longitude = -coords[1]
|
||||
kmlStr += '<Placemark id="' + str(i) + '">\n'
|
||||
kmlStr += ' <name>' + str(i) + '</name>\n'
|
||||
kmlStr += ' <Point>\n'
|
||||
kmlStr += ' <coordinates>' + str(longitude) + ',' + \
|
||||
str(coords[0]) + ',0</coordinates>\n'
|
||||
kmlStr += ' </Point>\n'
|
||||
kmlStr += '</Placemark>\n'
|
||||
|
||||
nogoLine = \
|
||||
'SEATTLE, USA: 122.247W,47.918, 122.39W,47.802, ' + \
|
||||
'122.389W,47.769, 122.377W,47.758, 122.371W,47.726, ' + \
|
||||
'122.379W,47.706, 122.4W,47.696, 122.405W,47.673, ' + \
|
||||
'122.416W,47.65, 122.414W,47.642, 122.391W,47.632, ' + \
|
||||
'122.373W,47.633, 122.336W,47.602, 122.288W,47.501, ' + \
|
||||
'122.299W,47.503, 122.386W,47.592, 122.412W,47.574, ' + \
|
||||
'122.394W,47.549, 122.388W,47.507, 122.35W,47.481, ' + \
|
||||
'122.365W,47.459, 122.33W,47.406, 122.323W,47.392, ' + \
|
||||
'122.321W,47.346, 122.441W,47.302, 122.696W,47.085, ' + \
|
||||
'122.926W,47.066, 122.929W,48.383'
|
||||
polygon = parseNogoString(nogoLine)
|
||||
nogoLine2 = \
|
||||
'SEATTLE, USA: 122.267W,47.758, 122.29W,47.471, ' + \
|
||||
'122.272W,47.693, 122.256W,47.672, 122.278W,47.652, ' + \
|
||||
'122.29W,47.583, 122.262W,47.548, 122.265W,47.52, ' + \
|
||||
'122.218W,47.498, 122.194W,47.501, 122.193W,47.55, ' + \
|
||||
'122.173W,47.58, 122.22W,47.617, 122.238W,47.617, ' + \
|
||||
'122.239W,47.637, 122.2W,47.644, 122.207W,47.703, ' + \
|
||||
'122.22W,47.705, 122.231W,47.699, 122.255W,47.751'
|
||||
polygon2 = parseNogoString(nogoLine2)
|
||||
nogoLine3 = \
|
||||
'SEATTLE, USA: 122.347W,47.675, 122.344W,47.681, ' + \
|
||||
'122.337W,47.685, 122.324W,47.679, 122.331W,47.677, ' + \
|
||||
'122.34W,47.669, 122.34W,47.664, 122.348W,47.665'
|
||||
polygon3 = parseNogoString(nogoLine3)
|
||||
nogoLine4 = \
|
||||
'SEATTLE, USA: 122.423W,47.669, 122.345W,47.641, ' + \
|
||||
'122.34W,47.625, 122.327W,47.626, 122.274W,47.64, ' + \
|
||||
'122.268W,47.654, 122.327W,47.654, 122.336W,47.647, ' + \
|
||||
'122.429W,47.684'
|
||||
polygon4 = parseNogoString(nogoLine4)
|
||||
nogoList = [polygon, polygon2, polygon3, polygon4]
|
||||
for i in range(1000):
|
||||
dayNumber = randint(10, 30)
|
||||
hour = randint(1, 23)
|
||||
hourStr = str(hour)
|
||||
if hour < 10:
|
||||
hourStr = '0' + hourStr
|
||||
currTime = datetime.datetime.strptime("2021-05-" + str(dayNumber) +
|
||||
" " + hourStr + ":14",
|
||||
"%Y-%m-%d %H:%M")
|
||||
coords = spoofGeolocation('', 'SEATTLE, USA', currTime,
|
||||
decoySeed, citiesList, nogoList)
|
||||
longitude = coords[1]
|
||||
if coords[3] == 'W':
|
||||
longitude = -coords[1]
|
||||
kmlStr += '<Placemark id="' + str(i) + '">\n'
|
||||
kmlStr += ' <name>' + str(i) + '</name>\n'
|
||||
kmlStr += ' <Point>\n'
|
||||
kmlStr += ' <coordinates>' + str(longitude) + ',' + \
|
||||
str(coords[0]) + ',0</coordinates>\n'
|
||||
kmlStr += ' </Point>\n'
|
||||
kmlStr += '</Placemark>\n'
|
||||
|
||||
kmlStr += '</Document>\n'
|
||||
kmlStr += '</kml>'
|
||||
kmlFile = open('unittest_decoy.kml', 'w+')
|
||||
|
|
|
|||
Loading…
Reference in New Issue