summaryrefslogtreecommitdiffstats
path: root/Src/PyCatcher/src
diff options
context:
space:
mode:
authorTom2011-08-16 13:03:35 +0200
committerTom2011-08-16 13:03:35 +0200
commit30381dbf4bd45b62a8a11100ea60c121a966a73a (patch)
treebdddcc9c7c3c5783b5a7982b35b95c2c5a73f5ba /Src/PyCatcher/src
parentInitial Commit (diff)
downloadimsi-catcher-detection-30381dbf4bd45b62a8a11100ea60c121a966a73a.tar.gz
imsi-catcher-detection-30381dbf4bd45b62a8a11100ea60c121a966a73a.tar.xz
imsi-catcher-detection-30381dbf4bd45b62a8a11100ea60c121a966a73a.zip
need to clean up git
Diffstat (limited to 'Src/PyCatcher/src')
-rw-r--r--Src/PyCatcher/src/driverConnector.py26
-rw-r--r--Src/PyCatcher/src/driverConnector.pycbin0 -> 1668 bytes
-rw-r--r--Src/PyCatcher/src/main.py10
-rw-r--r--Src/PyCatcher/src/model.pycbin0 -> 715 bytes
-rw-r--r--Src/PyCatcher/src/pyCatcherController.py23
-rw-r--r--Src/PyCatcher/src/pyCatcherController.pycbin0 -> 1621 bytes
-rw-r--r--Src/PyCatcher/src/pyCatcherModel.py35
-rw-r--r--Src/PyCatcher/src/pyCatcherModel.pycbin0 -> 1995 bytes
-rw-r--r--Src/PyCatcher/src/pyCatcherView.py39
-rw-r--r--Src/PyCatcher/src/pyCatcherView.pycbin0 -> 1883 bytes
10 files changed, 133 insertions, 0 deletions
diff --git a/Src/PyCatcher/src/driverConnector.py b/Src/PyCatcher/src/driverConnector.py
new file mode 100644
index 0000000..d7509e6
--- /dev/null
+++ b/Src/PyCatcher/src/driverConnector.py
@@ -0,0 +1,26 @@
+from pyCatcherModel import BaseStationInformation
+import subprocess
+import threading
+
+class DriverConnector:
+ def __init__ (self, bs_found_callback):
+ self._thread_break = False
+ self._bs_found_callback = bs_found_callback
+ pass
+
+ def start_scanning (self):
+ self._thread_break = False
+ threading.Thread(target= self._do_scan).start()
+
+ def _do_scan(self):
+ #TODO: insert right command here
+ ps_object = subprocess.Popen('ps', stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ while not self._thread_break:
+ base_station_info = BaseStationInformation()
+ base_station_info.parse_file(ps_object.stdout)
+ self._bs_found_callback(base_station_info)
+ ps_object.kill()
+
+ def stop_scanning (self):
+ self._thread_break = True
+ \ No newline at end of file
diff --git a/Src/PyCatcher/src/driverConnector.pyc b/Src/PyCatcher/src/driverConnector.pyc
new file mode 100644
index 0000000..ed713a0
--- /dev/null
+++ b/Src/PyCatcher/src/driverConnector.pyc
Binary files differ
diff --git a/Src/PyCatcher/src/main.py b/Src/PyCatcher/src/main.py
new file mode 100644
index 0000000..50f3d86
--- /dev/null
+++ b/Src/PyCatcher/src/main.py
@@ -0,0 +1,10 @@
+from pyCatcherController import PyCatcherController
+import time
+from pyCatcherView import PyCatcherGUI
+import gtk #@UnresolvedImport
+
+def main ():
+ controller = PyCatcherController()
+
+if __name__ == '__main__':
+ main() \ No newline at end of file
diff --git a/Src/PyCatcher/src/model.pyc b/Src/PyCatcher/src/model.pyc
new file mode 100644
index 0000000..3b1da01
--- /dev/null
+++ b/Src/PyCatcher/src/model.pyc
Binary files differ
diff --git a/Src/PyCatcher/src/pyCatcherController.py b/Src/PyCatcher/src/pyCatcherController.py
new file mode 100644
index 0000000..06d8c8e
--- /dev/null
+++ b/Src/PyCatcher/src/pyCatcherController.py
@@ -0,0 +1,23 @@
+import sys
+import pygtk
+import gtk #@UnresolvedImport
+import gtk.glade #@UnresolvedImport
+from driverConnector import DriverConnector
+from pyCatcherModel import BaseStationInformation
+from pyCatcherView import PyCatcherGUI
+
+class PyCatcherController:
+ def __init__(self):
+ self.gui = PyCatcherGUI(self)
+ gtk.main()
+ self.driver_connector = DriverConnector(self._foundBaseStationCallback)
+
+ def start_scan(self):
+ self.driver_connector.start_scanning()
+
+ def stop_scan(self):
+ self.driver_connector.stop_scanning()
+
+ def _foundBaseStationCallback(self):
+ print "found a station"
+ \ No newline at end of file
diff --git a/Src/PyCatcher/src/pyCatcherController.pyc b/Src/PyCatcher/src/pyCatcherController.pyc
new file mode 100644
index 0000000..5d9522a
--- /dev/null
+++ b/Src/PyCatcher/src/pyCatcherController.pyc
Binary files differ
diff --git a/Src/PyCatcher/src/pyCatcherModel.py b/Src/PyCatcher/src/pyCatcherModel.py
new file mode 100644
index 0000000..7ece9b6
--- /dev/null
+++ b/Src/PyCatcher/src/pyCatcherModel.py
@@ -0,0 +1,35 @@
+class BaseStationInformation:
+ def __init__ (self):
+ self.arcfn = 0
+ self.bsic = 0
+ self.rxlev = 0
+ self.s1 = []
+ self.s2 = []
+ self.s2bis = []
+ self.s2ter = []
+ self.s3 = []
+ self.s4 = []
+ self.neighbours = []
+
+ def parse_file(self, fileobject):
+ self.arcfn = fileobject.readline()
+ self.bsic = fileobject.readline()
+ self.rxlev = fileobject.readline()
+ self.s1 = fileobject.readline().split(' ')
+ self.s2 = fileobject.readline().split(' ')
+ self.s2bis = fileobject.readline().split(' ')
+ self.s2ter = fileobject.readline().split(' ')
+ self.s3 = fileobject.readline().split(' ')
+ self.s4 = fileobject.readline().split(' ')
+ return self
+
+ def __str__ (self):
+ return 'foo' + self.arcfn
+
+class BaseStationInformationList:
+ def __init__(self):
+ self.base_station_list
+
+ def add_station(self):
+ pass
+ \ No newline at end of file
diff --git a/Src/PyCatcher/src/pyCatcherModel.pyc b/Src/PyCatcher/src/pyCatcherModel.pyc
new file mode 100644
index 0000000..4a0570d
--- /dev/null
+++ b/Src/PyCatcher/src/pyCatcherModel.pyc
Binary files differ
diff --git a/Src/PyCatcher/src/pyCatcherView.py b/Src/PyCatcher/src/pyCatcherView.py
new file mode 100644
index 0000000..de71727
--- /dev/null
+++ b/Src/PyCatcher/src/pyCatcherView.py
@@ -0,0 +1,39 @@
+import sys
+import pygtk
+import gtk #@UnresolvedImport
+import gtk.glade #@UnresolvedImport
+
+class PyCatcherGUI:
+
+ def __init__(self, catcher_controller):
+ self.scan_toggled_on = False
+ self.catcher_controller = catcher_controller
+
+ self.w_tree = gtk.glade.XML("../GUI/mainWindow.glade")
+ self.main_window = self.w_tree.get_widget("main_window")
+ signals = {"on_main_window_destroy": gtk.main_quit,
+ "on_scan_toggle_toggled": self._toggle_scan
+ }
+ self.w_tree.signal_autoconnect(signals)
+
+ self.bs_view = self.w_tree.get_widget("bs_table")
+ self._add_column("foo", 0)
+ self._add_column("bar", 1)
+
+
+ def _add_column(self, name, index):
+ column = gtk.TreeViewColumn(name, gtk.CellRendererText(), text=index)
+ column.set_resizable(True)
+ column.set_sort_column_id(index)
+ self.bs_view.append_column(column)
+
+ def _toggle_scan (self, widget):
+ if(not self.scan_toggled_on):
+ print "toggle on"
+ self.catcher_controller.start_scan()
+ self.scan_toggled_on = True
+ else:
+ print "toggle off"
+ self.catcher_controller.stop_scan()
+ self.scan_toggled_on = False
+ \ No newline at end of file
diff --git a/Src/PyCatcher/src/pyCatcherView.pyc b/Src/PyCatcher/src/pyCatcherView.pyc
new file mode 100644
index 0000000..d30d8e0
--- /dev/null
+++ b/Src/PyCatcher/src/pyCatcherView.pyc
Binary files differ