예제 #1
0
def processGRGSM(bands):
    state = True
    cbands_list = ["GSM900",
                   "DCS1800",
                   "GSM850",
                   "PCS1900",
                   "GSM450",
                   "GSM480",
                   "GSM-R"]

    if bands is None:
        bands_list = cbands_list
    else:
        bands_list = bands.split(',')

    while state:
        try:
            for band in bands_list:
                statesmv(scanGRGSM,
                        "=> Switching to %s band" % band, arg=band)
        except (KeyboardInterrupt, SystemExit):
            state = False
            kb = mKB()
            cells = kb.data['SM_cells']
            saveCells(cells)
예제 #2
0
 def parseFifo(self):
     kb = mKB()
     FIFO = kb.config['file']
     if 'SM_cells' not in kb.data:
         kb.data['SM_cells'] = {}
     while True:
         with open(FIFO) as fifo:
             while True:
                 data = fifo.read()
                 if len(data) == 0:
                     break
                 infos = data.split(':')[1]
                 isplit = infos.split(';')
                 tmpcell = {}
                 tmpcell2 = {}
                 for cell in isplit:
                     pcell = cell.split('=')
                     tmpcell[pcell[0]] = pcell[1]
                 cid = tmpcell['CID'] + '-' + tmpcell['DL_UARFCN']
                 tmpcell2[cid] = {
                     'PLMN': tmpcell['PLMN'],
                     'RAC': tmpcell['RAC'],
                     'LAC': tmpcell['LAC'],
                     'type': '3G',
                     'RX': int(tmpcell['DL_UARFCN']),
                     'TX': int(tmpcell['UL_UARFCN'].split('\0')[0]),
                 }
                 self.go2logs(tmpcell2)
예제 #3
0
 def output2xml():
     from xml.dom.minidom import Document
     kb = mKB()
     root = doc.createElement('moncells')
     for k, v in kb.data['SM_cells'].items():
         cell = doc.createElement('cell')
         root.appendChild(cell)
예제 #4
0
 def parseFifo(self):
     kb = mKB()
     FIFO = kb.config['file']
     if os.path.isfile(FIFO) == False:
         try:
             os.mkfifo(FIFO)
         except:
             pass
     if 'SM_cells' not in kb.data:
         kb.data['SM_cells'] = {}
     while True:
         with open(FIFO) as fifo:
             while True:
                 data = fifo.read()
                 if len(data) == 0:
                     break
                 infos = data.split(':')[1]
                 isplit = infos.split(';')
                 tmpcell = {}
                 tmpcell2 = {}
                 for cell in isplit:
                     pcell = cell.split('=')
                     tmpcell[pcell[0]] = pcell[1]
                 cid = tmpcell['CID'] + '-' + tmpcell['DL_EARFCN']
                 tmpcell2[cid] = {
                     'FREQ': tmpcell['FREQ'],
                     'PLMN': "-1",
                     'type': "4G",
                     'eARFCN': int(tmpcell['DL_EARFCN']),
                     'POWER': tmpcell['POWER'],
                 }
                 self.go2logs(tmpcell2)
예제 #5
0
 def wrapped(*args, **kwargs):
     result = func(*args, **kwargs)
     kb = mKB()
     if 'SM_cells' not in kb.data:
         kb.data['SM_cells'] = {}
     id_ = v = None
     try:
         id_,v = list(result.items())[0]
     except:
         pass
         #print ("Error Celllog: %s" % result)
     if id_ not in kb.data['SM_cells'] and id_ is not None:
         kb.data['SM_cells'][id_] = v
         if kb.config['verbose'] == True:
             string2print = "[+] New cell detected [CellID/PCI-DL_freq  (%s)]" % id_
             string2print += "\n\r Network type=%s" % v['type']
             string2print += "\n\r PLMN=%s" % v['PLMN']
             if 'band' in v:
                 string2print += "\n\r Band=%i" % v['band']
             if '4G' in v['type']:
                 string2print += "\n\r Downlink EARFCN=%i" % v['eARFCN']
             elif '3G' in v['type']:
                 string2print += "\n\r Downlink UARFCN=%i" % v['RX']
                 if 'TX' in v:
                     string2print += "\n\r Uplink UARFCN=%i" % v['TX']
             elif '2G' in v['type']:
                 string2print += "\n\r ARFCN=%i" % v['arfcn']
             print (bcolors.OKGREEN+string2print+bcolors.ENDC)
     return result
예제 #6
0
def processOperatorADB(operators):
    sm = ADBshell()
    sm.androidsdkpath = mKB.config['androidsdk']
    state = True
    while state:
        try:
            for code in operators:
                statesmv(sm.deregister, "[+] Unregistered from current PLMN")
                statesmv(sm.changePLMN,
                         "=> Changing MCC/MNC for: %s" % code,
                         arg=code)
                statesmv(sm.changeNetworkType,
                         "=> Changing network type for 3G only",
                         arg=14)
                statesmv(sm.changeNetworkType,
                         "=> Changing network type for 2G only",
                         arg=13)
                statesmv(sm.changeNetworkType,
                         "=> Switching back to auto-mode",
                         arg=2)
        except (KeyboardInterrupt, SystemExit):
            state = False
            kb = mKB()
            cells = kb.data['SM_cells']
            saveCells(cells)
    process = sm.grablogcat()
예제 #7
0
# ----------------------------------------------------------------------------

from __future__ import print_function
from engines.android.generic.ADBshell import *
from engines.android.samsung.ServiceMode import *
from engines.host.diag.xgoldmod import *
from engines.host.serial.AT import AT
from utils.colors import *
from core.mKB import *
import time
from threading import Thread
import argparse
import json


kb = mKB()


def statesmv(func, msg=None, wait=10, arg=None):
    if msg is not None:
        print (bcolors.OKBLUE+msg+bcolors.ENDC)
    if arg is not None:
        func(arg)
    else:
        func()
    time.sleep(wait)


def bringTestMode():
    sm = ADBshell()
    sm.androidsdkpath = mKB.config['androidsdk']