summaryrefslogtreecommitdiffstats
path: root/Src/PyCatcher/src/pch_test.py
diff options
context:
space:
mode:
authorTom2012-05-28 22:48:08 +0200
committerTom2012-05-28 22:48:08 +0200
commitded6b56b3c24ec2f1fc1544c4bc872c71e54c99f (patch)
tree37aae445e53e2d0ba90fee7a1a8234443d826649 /Src/PyCatcher/src/pch_test.py
parentpaging image added (diff)
downloadimsi-catcher-detection-ded6b56b3c24ec2f1fc1544c4bc872c71e54c99f.tar.gz
imsi-catcher-detection-ded6b56b3c24ec2f1fc1544c4bc872c71e54c99f.tar.xz
imsi-catcher-detection-ded6b56b3c24ec2f1fc1544c4bc872c71e54c99f.zip
some more tex changes and experiments
Diffstat (limited to 'Src/PyCatcher/src/pch_test.py')
-rw-r--r--Src/PyCatcher/src/pch_test.py62
1 files changed, 62 insertions, 0 deletions
diff --git a/Src/PyCatcher/src/pch_test.py b/Src/PyCatcher/src/pch_test.py
new file mode 100644
index 0000000..9c9ae2b
--- /dev/null
+++ b/Src/PyCatcher/src/pch_test.py
@@ -0,0 +1,62 @@
+from settings import Commands
+import subprocess
+import time
+import datetime
+
+def main():
+
+ pch_retries = 5
+ max_scan_time = 20
+ arfcn = 17
+ pages_found = 0
+ ia_non_hop_found = 0
+ ia_hop_fund = 0
+
+ command = Commands['pch_command'] + ['-a', str(arfcn)]
+ scan_process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ time.sleep(2)
+ retry = False
+
+ start_time = datetime.datetime.now()
+ scan_time = datetime.datetime.now() - start_time
+
+ while(True):
+ if(retry):
+ scan_process.terminate()
+ scan_process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ retry = False
+
+ while(pch_retries > 0 and scan_time.seconds < max_scan_time):
+ scan_time = datetime.datetime.now() - start_time
+ line = scan_process.stdout.readline()
+ if line:
+ if 'Paging' in line:
+ pages_found += 1
+ if 'IMM' in line:
+ if 'HOP' in line:
+ ia_hop_fund += 1
+ else:
+ ia_non_hop_found += 1
+ if 'FBSB RESP: result=255' in line:
+ if(pch_retries > 0):
+ retry = True
+ break
+
+ if(retry):
+ pch_retries -= 1
+ else:
+ break
+
+ if scan_process:
+ scan_process.terminate()
+
+ result = {
+ 'Pagings': pages_found,
+ 'Assignments_hopping': ia_hop_fund,
+ 'Assignments_non_hopping': ia_non_hop_found
+ }
+
+ print result
+
+if __name__ == "__main__":
+ main() \ No newline at end of file