Adding CSV generating files
This commit is contained in:
5
.gitignore
vendored
5
.gitignore
vendored
@@ -1,3 +1,8 @@
|
||||
*.iq8s
|
||||
*.pyc
|
||||
*.log*
|
||||
|
||||
# Don't include the generated CSV related files
|
||||
generated/
|
||||
allICAO.py
|
||||
hackRFAllICAO.sh
|
||||
|
||||
13
README.md
13
README.md
@@ -7,10 +7,10 @@ This repository contains "ADS-B Out" encoder for Tx-capable SDR hardware.
|
||||
It is currently written in architecture independent Python language and can be used as an add-on for existing
|
||||
open source "ADS-B In" solutions. One known good example is [Stratux](https://github.com/cyoung/stratux).
|
||||
|
||||
## Disclaimer
|
||||
# Disclaimer
|
||||
The source code is published for academic purpose only.
|
||||
|
||||
## Instructions
|
||||
# Instructions
|
||||
1. Execute *ADSB_Encoder.py* all the options have defaults so none are needed to generate with defaults. Running help will show you the optiosn you can change:
|
||||
```
|
||||
$ ./ADSB_Encoder.py
|
||||
@@ -91,14 +91,19 @@ $
|
||||
* -f is the frequency in hertz. In the real world this would be 1090000000 but do not use that
|
||||
* -s is the sample rate in hertz
|
||||
* -x is the gain
|
||||
## Validation
|
||||
3. Receive the Signal
|
||||
```
|
||||
$ sudo ./dump1090 --net --freq 915000000
|
||||
...
|
||||
```
|
||||

|
||||
|
||||
## References
|
||||
# Generate CSV files
|
||||
These CSV files can be used for input into the application
|
||||
## generateAllICAO.py
|
||||
This script will generate a CSV with all the different ICAO numbers in it.
|
||||
|
||||
# References
|
||||
1. "*Gr-Air-Modes*", **Nick Foster**, 2012
|
||||
2. "*EXPLOITING THE AUTOMATIC DEPENDENT SURVEILLANCE BROADCAST SYSTEM VIA FALSE TARGET INJECTION*", **Domenic Magazu III**, 2012
|
||||
3. "*ADS-B out by HACKRF and received over the air by rtl-sdr dongle and dump1090*", **Jiao Xianjun**, 2014
|
||||
|
||||
78
generateAllICAO.py
Executable file
78
generateAllICAO.py
Executable file
@@ -0,0 +1,78 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Will generate a CSV with all ICAOS
|
||||
import csv
|
||||
import os
|
||||
|
||||
def writeFile(directory, filename, filenameExtension, data, count):
|
||||
csvFilename = os.path.join(directory, "%s-%s.%s"%(filename, count, filenameExtension))
|
||||
with open(csvFilename, 'w', newline='') as csvfile:
|
||||
output = csv.writer(csvfile, delimiter=',', quotechar='"', quoting=csv.QUOTE_MINIMAL)
|
||||
output.writerow(['icao'])
|
||||
for row in data:
|
||||
output.writerow([row])
|
||||
csvfile.close()
|
||||
return "['%s', '%s-%s.iq8s'],"%(csvFilename, filename, count)
|
||||
|
||||
def main():
|
||||
directory = 'generated'
|
||||
filename = 'allICAO'
|
||||
filenameExtension = 'csv'
|
||||
scriptFilename = 'allICAO.py'
|
||||
hackRFScriptFilename = 'hackRFAllICAO.sh'
|
||||
|
||||
minICAO = 0x0
|
||||
maxICAO = 0x3E8
|
||||
splitNumber = 10000
|
||||
|
||||
try:
|
||||
os.stat(directory)
|
||||
except:
|
||||
os.mkdir(directory)
|
||||
|
||||
script = open(scriptFilename, 'w')
|
||||
script.write('#!/usr/bin/env python3\n')
|
||||
script.write('import time\n')
|
||||
script.write('import threading\n')
|
||||
script.write('from ADSB_Encoder import *\n')
|
||||
|
||||
hackRFScript = open(hackRFScriptFilename, 'w')
|
||||
hackRFScript.write('#!/bin/bash\n')
|
||||
|
||||
|
||||
i = minICAO
|
||||
j = 0
|
||||
k = 0
|
||||
data = []
|
||||
|
||||
files = ''
|
||||
while i <= maxICAO:
|
||||
if j == splitNumber:
|
||||
files += writeFile(directory, filename, filenameExtension, data, k)
|
||||
data = []
|
||||
k += 1
|
||||
j = 0
|
||||
hackRFScript.write("hackrf_transfer -t %s-%s.iq8s -f 915000000 -s 2000000 -x 10\n" % (filename, k))
|
||||
data.append(hex(i))
|
||||
i += 1
|
||||
j += 1
|
||||
files += writeFile(directory, filename, filenameExtension, data, k)
|
||||
data = []
|
||||
k += 1
|
||||
j = 0
|
||||
hackRFScript.write("hackrf_transfer -t %s-%s.iq8s -f 915000000 -s 2000000 -x 10\n" % (filename, k))
|
||||
files = files[:-1]
|
||||
script.write('files = (%s)\n' % (files))
|
||||
script.write('for file in files:\n')
|
||||
script.write(' t = threading.Thread(target=threadingCSV, args=(file,))\n')
|
||||
script.write(' t.start()\n')
|
||||
script.write(' print(file)\n')
|
||||
script.write(' time.sleep(1)\n')
|
||||
script.close()
|
||||
hackRFScript.close()
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user