コード例 #1
0
    args = parser.parse_args()
    Path("/var/lib/osmocom/").mkdir(parents=True, exist_ok=True)
    hlr_path = "/var/lib/osmocom/hlr.sqlite3"
    user_interaction = args.user_interaction
    config = args.config
    gprs = args.gprs
    interface = args.interface
    sip = args.sip

    signal.signal(signal.SIGINT, signal_handler)

    sdr_check()
    configure(gprs, sip, interface)

    run(gprs, sip)
    check_errors()
    db = HLR.Database(hlr_path)
    print("[+] Done")
    time.sleep(3)

    while 1:
        if user_interaction:
            for user in db.get_new_users():
                extension = user[5]
                time.sleep(3)
                user_interact.interact(config, extension)

        monitor.update_monitor(db.get_subscribers())
        check_errors()
        time.sleep(1)
コード例 #2
0
ファイル: interact.py プロジェクト: zhidada/osmo-nitb-scripts
        default="config.json",
        help="Config file for auto user interaction. (Default=config.json)")

    parser.add_argument(
        "-D",
        "--hlr",
        default="/var/lib/osmocom/hlr.sqlite3",
        help=
        "Config file for auto user interaction. (Default=/var/lib/osmocom/hlr.sqlite3)"
    )

    parser.add_argument("-e",
                        "--extension",
                        default="all",
                        help="Phone number. (Default=all)")

    args = parser.parse_args()
    if args.extension == "all":
        try:
            db = HLR.Database(args.hlr)
            for user in db.get_subscribers():
                extension = user[5]
                user_interact.interact(args.config, extension)
                monitor.update_monitor(db.subscribers)

        except Exception as e:
            print("[-] {}".format(e))
            exit(1)
    else:
        user_interact.interact(args.config, args.extension)