repo stringlengths 2 99 | file stringlengths 13 225 | code stringlengths 0 18.3M | file_length int64 0 18.3M | avg_line_length float64 0 1.36M | max_line_length int64 0 4.26M | extension_type stringclasses 1
value |
|---|---|---|---|---|---|---|
internalblue | internalblue-master/examples/nexus5/LMP_MAC_Address_Filter.py | #!/usr/bin/env python3
# Jiska Classen, Secure Mobile Networking Lab
from internalblue import Address
from internalblue.adbcore import ADBCore
from pwnlib.asm import asm
from binascii import unhexlify
"""
Filter connections by MAC address before entering LMP dispatcher.
Enter MAC addresses you trust into whitelist.
"... | 3,814 | 31.330508 | 92 | py |
internalblue | internalblue-master/examples/nexus5/randp.py | #!/usr/bin/python2
# Jiska Classen, Secure Mobile Networking Lab
import sys
from argparse import Namespace
from pwnlib import adb
from pwnlib.asm import asm
from internalblue.adbcore import ADBCore
import internalblue.hci as hci
import numpy as np
from internalblue.cli import InternalBlueCLI
"""
Measure the RNG of ... | 6,024 | 27.419811 | 107 | py |
internalblue | internalblue-master/examples/nexus5/rand.py | #!/usr/bin/python2
# Jiska Classen, Secure Mobile Networking Lab
import sys
from argparse import Namespace
from pwnlib import adb
from pwnlib.asm import asm
from internalblue.adbcore import ADBCore
import internalblue.hci as hci
import numpy as np
from datetime import datetime
from internalblue.cli import Internal... | 5,830 | 25.625571 | 107 | py |
internalblue | internalblue-master/examples/nexus5/CVE_2018_5383_Invalid_Curve_Attack_PoC.py | #!/usr/bin/env python3
# Dennis Mantz
from internalblue import Address
from internalblue.adbcore import ADBCore
from pwnlib.asm import asm
internalblue = ADBCore()
device_list = internalblue.device_list()
if len(device_list) == 0:
internalblue.logger.warning("No ADB devices connected!")
exit(-1)
internalblue.... | 4,218 | 33.867769 | 106 | py |
internalblue | internalblue-master/examples/nexus5/NiNo_PoC.py | #!/usr/bin/env python3
# Jiska Classen, Secure Mobile Networking Lab
import sys
from internalblue import Address
from internalblue.adbcore import ADBCore
from pwnlib.asm import asm
"""
In a NiNo attack an active MITM fakes that the other device has no in put and no output capabilities. We think smartphones should n... | 3,769 | 37.469388 | 374 | py |
internalblue | internalblue-master/examples/eval_cyw20735/CVE_2018_19860_Crash_on_Connect.py | #!/usr/bin/python3
# Jiska Classen, Secure Mobile Networking Lab
# PoC for CVE-2018-19860
from pwnlib.asm import asm
from internalblue.hcicore import HCICore
from internalblue.utils.packing import p32
"""
This is a crash only test for CVE-2018-19860. Install this patch and connect
to any device. If the target device... | 6,042 | 36.534161 | 147 | py |
internalblue | internalblue-master/examples/eval_cyw20735/BLE_Reception_PoC.py | #!/usr/bin/python2
from internalblue.adbcore import ADBCore
from internalblue.hcicore import HCICore
"""
Script that shows receive statistics from LE connections over HCI on the CYW20735B1 evaluation board.
Generated with Nexmon.
"""
internalblue = ADBCore()
try:
internalblue.interface = internalblue.device_list... | 2,865 | 59.978723 | 406 | py |
internalblue | internalblue-master/examples/eval_cyw20735/KNOB_PoC.py | #!/usr/bin/env python3
# Jiska Classen, Secure Mobile Networking Lab
import sys
import argparse
from argparse import Namespace
import cmd2
from cmd2 import CommandSet
from pwnlib.asm import asm
from internalblue import Address, hci
from internalblue.cli import InternalBlueCLI, auto_int
from internalblue.hcicore impo... | 3,517 | 37.23913 | 141 | py |
internalblue | internalblue-master/examples/eval_cyw20735/LMP_Filter_PoC.py | #!/usr/bin/python3
"""
WiSec 2021 tutorial example by Jiska Classen.
Hooks into LMP handler for Remote Feature Results and overwrites features.
"""
# imports for ADB and HCi core
from internalblue.adbcore import ADBCore
from internalblue.hcicore import HCICore
# imports for calling InternalBlue CLI
from internalblue... | 3,176 | 35.102273 | 119 | py |
internalblue | internalblue-master/examples/eval_cyw20735/rand.py | #!/usr/bin/python3
# Jiska Classen, Secure Mobile Networking Lab
import sys
from argparse import Namespace
from datetime import datetime
import numpy as np
from pwnlib.asm import asm
import internalblue.hci as hci
from internalblue.cli import InternalBlueCLI
from internalblue.hcicore import HCICore
from internalblu... | 6,744 | 27.824786 | 112 | py |
internalblue | internalblue-master/examples/eval_cyw20719/randp.py | #!/usr/bin/python3
# Jiska Classen, Secure Mobile Networking Lab
import sys
from argparse import Namespace
from datetime import datetime
import numpy as np
from pwnlib.asm import asm
import internalblue.hci as hci
from internalblue.cli import InternalBlueCLI
from internalblue.hcicore import HCICore
from internalblu... | 7,450 | 29.288618 | 115 | py |
internalblue | internalblue-master/examples/eval_cyw20719/rand.py | #!/usr/bin/python3
# Jiska Classen, Secure Mobile Networking Lab
import sys
from argparse import Namespace
from datetime import datetime
import numpy as np
from pwnlib.asm import asm
import internalblue.hci as hci
from internalblue.cli import InternalBlueCLI
from internalblue.hcicore import HCICore
from internalblu... | 7,421 | 28.688 | 115 | py |
internalblue | internalblue-master/examples/rpi3/BLE_Reception_PoC.py | #!/usr/bin/env python3
# Jiska Classen
# Get receive statistics on a Raspberry Pi 3 for BLE connection events
from internalblue import Address
from internalblue.hcicore import HCICore
from pwnlib.asm import asm
internalblue = HCICore()
device_list = internalblue.device_list()
if len(device_list) == 0:
internalbl... | 2,605 | 28.280899 | 96 | py |
internalblue | internalblue-master/examples/rpi3/KNOB_PoC.py | #!/usr/bin/python3
# Jiska Classen, Secure Mobile Networking Lab
import sys
import argparse
from argparse import Namespace
import cmd2
from cmd2 import CommandSet
from pwnlib.asm import asm
from internalblue import Address, hci
from internalblue.cli import InternalBlueCLI, auto_int
from internalblue.hcicore import H... | 3,502 | 37.076087 | 141 | py |
internalblue | internalblue-master/examples/rpi3/randp.py | #!/usr/bin/python3
# Jiska Classen, Secure Mobile Networking Lab
import os
import sys
from argparse import Namespace
import numpy as np
from pwnlib.asm import asm
import internalblue.hci as hci
from internalblue.cli import InternalBlueCLI
from internalblue.hcicore import HCICore
"""
Measure the RNG of the Raspberr... | 6,041 | 27.366197 | 123 | py |
internalblue | internalblue-master/examples/rpi3/rand.py | #!/usr/bin/python3
# Jiska Classen, Secure Mobile Networking Lab
import os
import sys
from argparse import Namespace
import numpy as np
from pwnlib.asm import asm
import internalblue.hci as hci
from internalblue.cli import InternalBlueCLI
from internalblue.hcicore import HCICore
"""
Measure the RNG of the Raspberr... | 5,876 | 26.591549 | 135 | py |
internalblue | internalblue-master/examples/eval_cyw20819/randp.py | #!/usr/bin/python3
# Jiska Classen, Secure Mobile Networking Lab
import sys
import binascii
from argparse import Namespace
from datetime import datetime
import numpy as np
from pwnlib.asm import asm
import internalblue.hci as hci
from internalblue.cli import InternalBlueCLI
from internalblue.hcicore import HCICore
... | 7,815 | 30.264 | 115 | py |
internalblue | internalblue-master/examples/eval_cyw20819/rand.py | #!/usr/bin/python3
# Jiska Classen, Secure Mobile Networking Lab
import sys
from argparse import Namespace
from datetime import datetime
import numpy as np
from pwnlib.asm import asm
import internalblue.hci as hci
from internalblue.cli import InternalBlueCLI
from internalblue.hcicore import HCICore
"""
Measure the... | 7,487 | 28.952 | 115 | py |
internalblue | internalblue-master/examples/rpi3p_rpi4/BLE_Reception_PoC.py | #!/usr/bin/env python3
# Jiska Classen
# Get receive statistics on a Raspberry Pi 3 for BLE connection events
from pwnlib.asm import asm
from internalblue import Address
from internalblue.hcicore import HCICore
internalblue = HCICore()
device_list = internalblue.device_list()
if len(device_list) == 0:
internalbl... | 2,607 | 28.636364 | 96 | py |
internalblue | internalblue-master/examples/rpi3p_rpi4/KNOB_PoC.py | #!/usr/bin/python3
# Jiska Classen, Secure Mobile Networking Lab
import sys
import argparse
from argparse import Namespace
import cmd2
from cmd2 import CommandSet
from pwnlib.asm import asm
from internalblue import Address, hci
from internalblue.cli import InternalBlueCLI, auto_int
from internalblue.hcicore import H... | 3,505 | 37.108696 | 141 | py |
internalblue | internalblue-master/examples/rpi3p_rpi4/randp.py | #!/usr/bin/python2
# Jiska Classen, Secure Mobile Networking Lab
import os
import sys
from argparse import Namespace
import numpy as np
from pwnlib.asm import asm
import internalblue.hci as hci
from internalblue.cli import InternalBlueCLI
from internalblue.hcicore import HCICore
"""
Measure the RNG of the Raspberr... | 5,975 | 27.188679 | 116 | py |
internalblue | internalblue-master/examples/rpi3p_rpi4/rand.py | #!/usr/bin/python2
# Jiska Classen, Secure Mobile Networking Lab
import os
import sys
from argparse import Namespace
import numpy as np
from pwnlib.asm import asm
import internalblue.hci as hci
from internalblue.cli import InternalBlueCLI
from internalblue.hcicore import HCICore
"""
Measure the RNG of the Raspberr... | 5,917 | 26.398148 | 116 | py |
internalblue | internalblue-master/examples/iphone7/rand.py | #!/usr/bin/python2
# Jiska Classen, Secure Mobile Networking Lab
import sys
from argparse import Namespace
from datetime import datetime
import numpy as np
from pwnlib.asm import asm
import internalblue.hci as hci
from internalblue.cli import InternalBlueCLI
from internalblue.ioscore import iOSCore
"""
Measure the... | 6,646 | 26.811715 | 115 | py |
internalblue | internalblue-master/examples/s8/BLE_Reception_PoC.py | #!/usr/bin/env python3
# Jiska Classen
# Get receive statistics on a Samsung Galaxy S8 for BLE connection events
import sys
from argparse import Namespace
from pwnlib.asm import asm
import internalblue.hci as hci
from internalblue.adbcore import ADBCore
from internalblue.cli import InternalBlueCLI
from internalblue... | 6,297 | 33.988889 | 135 | py |
internalblue | internalblue-master/examples/s8/KNOB_PoC.py | #!/usr/bin/python3
# Jiska Classen, Secure Mobile Networking Lab
import sys
import argparse
from argparse import Namespace
import cmd2
from cmd2 import CommandSet
from pwnlib.asm import asm
from internalblue import Address, hci
from internalblue.adbcore import ADBCore
from internalblue.cli import InternalBlueCLI, a... | 3,543 | 37.107527 | 141 | py |
internalblue | internalblue-master/examples/s8/randp.py | #!/usr/bin/python2
# Jiska Classen, Secure Mobile Networking Lab
import sys
from argparse import Namespace
from time import sleep
import numpy as np
from pwnlib import adb
from pwnlib.asm import asm
import internalblue.hci as hci
from internalblue.adbcore import ADBCore
from internalblue.cli import InternalBlueCLI
... | 6,093 | 27.082949 | 107 | py |
internalblue | internalblue-master/tests/test_heap_old.py | from __future__ import print_function
from internalblue.cli import _parse_argv
from internalblue.adbcore import ADBCore
import os
import nose
try:
from typing import List, Optional, Any, TYPE_CHECKING, Tuple
except ImportError:
pass
def test_info_heap_old():
dummy = [
{
'index':0,
... | 6,830 | 28.192308 | 96 | py |
internalblue | internalblue-master/tests/test_info_conn_9.py | from __future__ import print_function
from internalblue.cli import _parse_argv
from internalblue.adbcore import ADBCore
from internalblue.objects.connection_information import ConnectionInformation
import os
import nose
try:
from typing import List, Optional, Any, TYPE_CHECKING, Tuple
except ImportError:
pass... | 1,671 | 31.784314 | 101 | py |
internalblue | internalblue-master/tests/test_info_conn_7.py | from __future__ import print_function
from internalblue.cli import _parse_argv
from internalblue.adbcore import ADBCore
from internalblue.objects.connection_information import ConnectionInformation
import os
import nose
try:
from typing import List, Optional, Any, TYPE_CHECKING, Tuple
from internalblue import... | 1,797 | 32.924528 | 111 | py |
internalblue | internalblue-master/tests/test_queue.py | from __future__ import print_function
from internalblue.cli import _parse_argv
from internalblue.adbcore import ADBCore
from internalblue.objects.queue_element import QueueElement
import os
import nose
try:
from typing import List, Optional, Any, TYPE_CHECKING, Tuple
except ImportError:
pass
def test_info_qu... | 3,368 | 52.47619 | 137 | py |
internalblue | internalblue-master/tests/test_heap_new.py | from __future__ import print_function
from internalblue.cli import _parse_argv
from internalblue.hcicore import HCICore
import os
import nose
try:
from typing import List, Optional, Any, TYPE_CHECKING, Tuple
except ImportError:
pass
def test_info_heap_new():
dummy = [
{
"index": 0,
... | 8,855 | 30.404255 | 96 | py |
internalblue | internalblue-master/tests/all_traces_test.py | 0 | 0 | 0 | py | |
internalblue | internalblue-master/tests/traces/testwrapper.py | from builtins import object
import argparse
from internalblue.cli import InternalBlueCLI, parse_args
import os
try:
from typing import List, Optional, Any, TYPE_CHECKING, Tuple
except ImportError:
pass
tracedir = os.path.dirname(__file__)
class Fakeargs(object):
def __init__(self):
self.data_... | 1,808 | 24.478873 | 77 | py |
internalblue | internalblue-master/tests/traces/__init__.py | from __future__ import print_function
from __future__ import absolute_import
from tests.traces.testwrapper import trace_test, get_trace_path_cmd_tuple
import unittest
import os
tracedir = os.path.dirname(__file__)
def generate_test_suite_from_traces():
def generate_test_from_file(core, tracefile):
trace... | 1,910 | 33.125 | 124 | py |
internalblue | internalblue-master/internalblue/usbmux.py | #
# usbmux.py - usbmux client library for Python
#
# Copyright (C) 2009 Hector Martin "marcan" <hector@marcansoft.com>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 or versi... | 8,893 | 36.846809 | 163 | py |
internalblue | internalblue-master/internalblue/adbcore.py | #!/usr/bin/env python2
import struct
import threading
from time import sleep
from typing import Optional
from future import standard_library
import datetime
import socket
import queue as queue2k
import random
from ppadb.device import Device
from ppadb.connection import Connection
from ppadb.client import Client as A... | 15,791 | 37.896552 | 174 | py |
internalblue | internalblue-master/internalblue/core.py | #!/usr/bin/env python2
# core.py
#
# This file contains the main class of the framework which
# includes the thread functions for the receive and send thread.
# It also implements methods to setup the TCP connection to the
# Android Bluetooth stack via ADB port forwarding
#
# Copyright (c) 2020 The InternalBlue Team. ... | 94,852 | 41.288453 | 195 | py |
internalblue | internalblue-master/internalblue/macoscore.py | #!/usr/bin/env python2
from __future__ import absolute_import
import os
import queue as queue2k
import random
import socket
import time
from builtins import str
from future import standard_library
from . import hci
from .core import InternalBlue
from .utils.packing import p8
standard_library.install_aliases()
file... | 8,169 | 32.346939 | 104 | py |
internalblue | internalblue-master/internalblue/ioscore.py | #!/usr/bin/env python2
from __future__ import absolute_import
from future import standard_library
standard_library.install_aliases()
from builtins import str
import socket
import queue as queue2k
from . import hci
from .usbmux import USBMux, MuxError
from .core import InternalBlue
import sys
class iOSCore(Interna... | 9,316 | 34.561069 | 113 | py |
internalblue | internalblue-master/internalblue/cli.py | #!/usr/bin/env python2
# cli.py
#
# This file is meant to be executed by the user in order to start
# an interactive CLI. It creates an instance of the framework and
# enters a command loop which is implemented using cmd2.
# Commands entered by the user are automatically matched
# to functions starting with do_* and e... | 79,472 | 42.238847 | 154 | py |
internalblue | internalblue-master/internalblue/hci.py | #!/usr/bin/env python2
# hci.py
#
# The hci.py file contains classes and functions to parse and
# craft HCI packets.
#
# HCI code was partially taken from https://github.com/joekickass/python-btsnoop
#
# Copyright (c) 2018 Dennis Mantz. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obta... | 46,226 | 36.521916 | 158 | py |
internalblue | internalblue-master/internalblue/hcicore.py | #!/usr/bin/env python2
from __future__ import absolute_import
import datetime
import fcntl
import queue as queue2k
import socket
import struct
import threading
from builtins import range
from builtins import str
from builtins import zip
from ctypes import *
from typing import List, cast, TYPE_CHECKING
from future ... | 16,542 | 34.653017 | 106 | py |
internalblue | internalblue-master/internalblue/_old_utils.py | 0 | 0 | 0 | py | |
internalblue | internalblue-master/internalblue/__init__.py | from future import standard_library
standard_library.install_aliases()
import datetime
from queue import Queue
from typing import (
List,
Optional,
Any,
TYPE_CHECKING,
Tuple,
Union,
NewType,
Callable,
Dict,
)
Address = NewType("Address", int)
ConnectionNumber = NewType("Connectio... | 1,414 | 24.727273 | 69 | py |
internalblue | internalblue-master/internalblue/socket_hooks.py | from __future__ import print_function
from builtins import object
import binascii
import time
try:
from typing import List, Optional, Any, TYPE_CHECKING, Tuple, Dict, Type
except ImportError:
pass
class SocketRecvHook(object):
def __init__(self, socket):
# type: (socket.socket) -> None
s... | 9,484 | 29.695793 | 97 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x422a.py | #!/usr/bin/env python
# MacBook 15" early 2011 tested with Ubuntu
#
# Generic firmware file in case we do not know something...
#
# Copyright (c) 2019 Jiska Classen. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the... | 1,679 | 39.97561 | 82 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x2056.py | #!/usr/bin/env python
# fw_0x2056.py
#
# Copyright (c) 2020 The InternalBlue Team. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limi... | 2,409 | 42.818182 | 88 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x1111.py | #!/usr/bin/env python
# fw_0x1111.py
#
# Copyright (c) 2020 The InternalBlue Team. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limi... | 6,431 | 37.51497 | 111 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x6119.py | #!/usr/bin/env python
# fw_0x6119.py
#
# All firmware specific data such as address offsets are collected
# in the fw.py file. Later versions of the framework will provide
# multiple copies of this file in order to target different firmware
# and chip versions.
#
# Copyright (c) 2020 The InternalBlue Team. (MIT Licens... | 3,846 | 38.255102 | 111 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x420e.py | # fw_0x420e.py
#
# Generic firmware file in case we do not know something...
#
# Copyright (c) 2020 The InternalBlue Team. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software with... | 6,593 | 40.734177 | 113 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x21a9.py | # fw_default.py
#
# Generic firmware file in case we do not know something...
#
# Copyright (c) 2020 The InternalBlue Team. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software wit... | 2,002 | 43.511111 | 88 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x4196.py | #!/usr/bin/env python
#
# fw_0x220e.py
#
# Firmware file for BCM20702A1 chipsets. These chipsets are typically used for
# Bluetooth USB dongles.
#
# Copyright (c) 2019 Jan Ruge and Jiska Classen. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associ... | 1,794 | 41.738095 | 107 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x3040.py | #!/usr/bin/env python
# fw_0x3032.py
#
# Copyright (c) 2020 The InternalBlue Team. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limi... | 2,080 | 40.62 | 88 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x420e_iphone.py | # fw_0x420e.py
#
# Generic firmware file in case we do not know something...
#
# Copyright (c) 2019 Jiska Classen. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without rest... | 2,383 | 40.103448 | 88 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x2209.py | #!/usr/bin/env python
# fw_0x2209.py
#
# All firmware specific data such as address offsets are collected
# in the fw.py file. Later versions of the framework will provide
# multiple copies of this file in order to target different firmware
# and chip versions.
#
# Copyright (c) 2020 The InternalBlue Team. (MIT Licens... | 3,913 | 39.350515 | 111 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x4228.py | # fw_0x4228.py
#
# Generic firmware file in case we do not know something...
#
# Copyright (c) 2019 Jiska Classen. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without rest... | 2,304 | 42.490566 | 105 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x240f.py | #!/usr/bin/env python
# fw.py
#
# All firmware specific data such as address offsets are collected
# in the fw.py file. Later versions of the framework will provide
# multiple copies of this file in order to target different firmware
# and chip versions.
#
# Copyright (c) 2018 Dennis Mantz. (MIT License)
#
# Permissio... | 8,925 | 50.298851 | 121 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x3032.py | #!/usr/bin/env python
# fw_0x3032.py
#
# Copyright (c) 2020 The InternalBlue Team. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limi... | 2,155 | 42.12 | 133 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x6103.py | #!/usr/bin/env python
# fw_0x6103.py
#
# Copyright (c) 2019 Dennis Heinze. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation t... | 2,232 | 40.351852 | 82 | py |
internalblue | internalblue-master/internalblue/fw/fw_default.py | #!/usr/bin/env python
# fw_default.py
#
# Generic firmware file in case we do not know something...
#
# Copyright (c) 2019 Jiska Classen. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# t... | 1,696 | 41.425 | 82 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x2230.py | #!/usr/bin/env python
# Copyright (c) 2019 Jiska Classen. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limitation the rights to
# us... | 2,351 | 48 | 108 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x203a.py | #!/usr/bin/env python
# fw_0x2033.py
#
# Copyright (c) 2020 The InternalBlue Team. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limi... | 2,296 | 42.339623 | 137 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x21d0.py | #!/usr/bin/env python
#
# fw_0x21d0.py
#
# Firmware file for BCM2046 chipsets. These chipsets are typically used for
# in older MacBooks and iMacs.
#
# Copyright (c) 2020 Jiska Classen. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated docum... | 1,716 | 43.025641 | 82 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x6109.py | #!/usr/bin/env python
# fw_0x6109.py
#
# All firmware specific data such as address offsets are collected
# in the fw.py file. Later versions of the framework will provide
# multiple copies of this file in order to target different firmware
# and chip versions.
#
# Copyright (c) 2018 Dennis Mantz. (MIT License)
#
# Pe... | 17,438 | 41.953202 | 121 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x4109.py | # fw_0x420e.py
#
# Generic firmware file in case we do not know something...
#
# Copyright (c) 2019 Jiska Classen. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without rest... | 4,106 | 44.633333 | 123 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x411a.py | # fw_0x420e.py
#
# Generic firmware file in case we do not know something...
#
# Copyright (c) 2019 Jiska Classen. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without rest... | 2,143 | 38.703704 | 88 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x220c.py | # fw_0x420e.py
#
# Generic firmware file in case we do not know something...
#
# Copyright (c) 2020 The InternalBlue Team. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software with... | 3,035 | 38.428571 | 99 | py |
internalblue | internalblue-master/internalblue/fw/__init__.py | from .fw import FirmwareDefinition
| 35 | 17 | 34 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x220b.py | # fw_0x420e.py
#
# Generic firmware file in case we do not know something...
#
# Copyright (c) 2019 Jiska Classen. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without rest... | 2,031 | 42.234043 | 88 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x220e.py | #!/usr/bin/env python
#
# fw_0x220e.py
#
# Firmware file for BCM20702A1 chipsets. These chipsets are typically used for
# Bluetooth USB dongles.
#
# Copyright (c) 2019 Jan Ruge and Jiska Classen. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associ... | 1,965 | 43.681818 | 111 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x617e.py | # fw_0x617e.py
#
# Generic firmware file in case we do not know something...
#
# Copyright (c) 2019 Jiska Classen. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without rest... | 2,125 | 41.52 | 88 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x4208.py | # fw_default.py
#
# Generic firmware file in case we do not know something...
#
# Copyright (c) 2020 The InternalBlue Team. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software wit... | 10,744 | 42.857143 | 119 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x6206.py | # fw_0x420e.py
#
# Generic firmware file in case we do not know something...
#
# Copyright (c) 2019 Jiska Classen. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without rest... | 2,059 | 40.2 | 88 | py |
internalblue | internalblue-master/internalblue/fw/fw.py | #!/usr/bin/env python
# fw.py
#
# Implements all types of Broadcom Bluetooth firmware we know or loads default
# firmware instead.
#
# Copyright (c) 2019 Jiska Classen. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (... | 5,377 | 30.822485 | 99 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x2033.py | #!/usr/bin/env python
# fw_0x2033.py
#
# Copyright (c) 2020 The InternalBlue Team. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without restriction, including without limi... | 2,092 | 40.86 | 88 | py |
internalblue | internalblue-master/internalblue/fw/fw_0x6308.py | # fw_0x6308.py
#
# Generic firmware file in case we do not know something...
#
# Copyright (c) 2021 Jiska Classen. (MIT License)
#
# Permission is hereby granted, free of charge, to any person obtaining a copy of
# this software and associated documentation files (the "Software"), to deal in
# the Software without rest... | 2,421 | 41.491228 | 88 | py |
internalblue | internalblue-master/internalblue/objects/connection_information.py | from builtins import object
from typing import Any
from internalblue.utils.packing import u8, u16, u32
class ConnectionInformation(object):
connection_handle = 0
connection_number = 0
master_of_connection = False
remote_name_address = 0
remote_address = None
id: bytearray
public_rand = No... | 3,278 | 36.261364 | 119 | py |
internalblue | internalblue-master/internalblue/objects/queue_element.py | from builtins import object
from typing import Any
class QueueElement(object):
index = 0
next_item = 0
prev = 0
capacity = 0
name = ""
queue_buf_start = 0
available_items = 0
item_size = 0
next_free_slot = 0
free_slots = 0
address = 0
waitlist_length = 0
next = 0
... | 1,345 | 21.813559 | 46 | py |
internalblue | internalblue-master/internalblue/objects/__init__.py | 0 | 0 | 0 | py | |
internalblue | internalblue-master/internalblue/utils/progress_logger.py | import random
import time
from internalblue.utils.logging_formatter import CustomFormatter
class ProgressLogger(object):
spinners = [
['/.......', './......', '../.....', '.../....', '..../...', '...../..', '....../.',
'.......\\', '......\\.', '.....\\..', '....\\...', '...\\....', '..\\.....',... | 2,686 | 32.17284 | 100 | py |
internalblue | internalblue-master/internalblue/utils/packing.py | import struct
def p8(num, endian: str = ''):
if endian.lower() == 'big':
return struct.pack('>B', num)
elif endian.lower() == 'little':
return struct.pack('<B', num)
return struct.pack('B', num)
def u8(num, endian: str = ''):
if endian.lower() == 'big':
return struct.unpack('... | 3,687 | 25.342857 | 88 | py |
internalblue | internalblue-master/internalblue/utils/__init__.py | import sys
from typing import Union
from internalblue import Address
def bytes_to_hex(data):
# type: (Union[bytes, bytearray]) -> str
return "".join(format(x, "02x") for x in bytearray(data))
def flat(data: [Address, bytes], filler: int) -> bytes:
res = bytes()
last_section_end = 0
for address ... | 978 | 26.971429 | 72 | py |
internalblue | internalblue-master/internalblue/utils/logging_formatter.py | import logging
class CustomFormatter(logging.Formatter):
"""Logging Formatter to add colors and count warning / errors"""
PROGRESS = 60
black = "\x1b[30m"
red = "\x1b[31m"
green = "\x1b[32m"
yellow = "\x1b[33m"
blue = "\x1b[34m"
magenta = "\x1b[35m"
cyan = "\x1b[36m"
white = ... | 995 | 26.666667 | 68 | py |
internalblue | internalblue-master/internalblue/utils/internalblue_logger.py | import logging
from internalblue.utils.logging_formatter import CustomFormatter
def getInternalBlueLogger() -> logging.Logger:
logger = logging.getLogger("InternalBlue")
logger.setLevel(logging.INFO)
# create console handler with a higher log level
ch = logging.StreamHandler()
ch.setFormatter(Cus... | 447 | 27 | 64 | py |
SCKD | SCKD-main/main.py | import argparse
import random
from sampler import data_sampler
from config import Config
import torch
from model.bert_encoder import Bert_Encoder
from model.dropout_layer import Dropout_Layer
from model.classifier import Softmax_Layer, Proto_Softmax_Layer
from data_loader import get_data_loader
import torch.nn.function... | 30,103 | 42.377522 | 153 | py |
SCKD | SCKD-main/sampler.py | import numpy as np
import json
import random
from transformers import BertTokenizer
class data_sampler(object):
def __init__(self, config=None, seed=None):
self.config = config
self.tokenizer = BertTokenizer.from_pretrained(self.config.bert_path, additional_special_tokens=["[E11]", "[E12]", "[E2... | 5,983 | 39.707483 | 141 | py |
SCKD | SCKD-main/data_loader.py | import torch
import torch.nn as nn
from torch.utils.data import Dataset, DataLoader
class data_set(Dataset):
def __init__(self, data,config=None):
self.data = data
self.config = config
def __len__(self):
return len(self.data)
def __getitem__(self, idx):
return self.data[i... | 1,197 | 25.622222 | 89 | py |
SCKD | SCKD-main/config.py | from configparser import ConfigParser
# This file is for parsing configs generated from config_generator.py.
# No need to run this file.
class Config(ConfigParser):
def __init__(self, config_file):
raw_config = ConfigParser()
raw_config.read(config_file)
self.cast_values(raw_config)
d... | 978 | 36.653846 | 88 | py |
SCKD | SCKD-main/model/base_model.py | import torch
import torch.nn as nn
import os
import json
class base_model(nn.Module):
def __init__(self):
super(base_model, self).__init__()
self.zero_const = nn.Parameter(torch.Tensor([0]))
self.zero_const.requires_grad = False
self.pi_const = nn.Parameter(torch.Tensor([3.14159265... | 1,737 | 31.185185 | 76 | py |
SCKD | SCKD-main/model/classifier.py | from torch import nn, optim
from model.base_model import base_model
import torch
class Softmax_Layer(base_model):
"""
Softmax classifier for sentence-level relation extraction.
"""
def __init__(self, input_size, num_class):
"""
Args:
num_class: number of classes
""... | 1,751 | 25.545455 | 72 | py |
SCKD | SCKD-main/model/dropout_layer.py | from torch import nn
import torch
from torch.nn.parameter import Parameter
import torch.nn.functional as F
from model.base_model import base_model
class LayerNorm(nn.Module):
def __init__(self, input_dim, cond_dim=0, center=True, scale=True, epsilon=None, conditional=False,
hidden_units=None, hid... | 3,674 | 36.886598 | 116 | py |
SCKD | SCKD-main/model/bert_encoder.py | import torch
import torch.nn as nn
import torch.nn.functional as F
import numpy as np
from model.base_model import base_model
from transformers import BertModel, BertConfig
class Bert_Encoder(base_model):
def __init__(self, config):
super(Bert_Encoder, self).__init__()
# load model
self.... | 3,473 | 41.888889 | 111 | py |
TaNP | TaNP-main/TaNP/TaNP_training.py | import os
import torch
import pickle
import random
from eval import testing
def training(trainer, opt, train_dataset, test_dataset, batch_size, num_epoch, model_save=True, model_filename=None, logger=None):
training_set_size = len(train_dataset)
for epoch in range(num_epoch):
random.shuffle(train_datas... | 1,561 | 41.216216 | 130 | py |
TaNP | TaNP-main/TaNP/embeddings_TaNP.py | import torch
import torch.nn as nn
import torch.nn.init as init
import torch.nn.functional as F
class Item(torch.nn.Module):
def __init__(self, config):
super(Item, self).__init__()
self.feature_dim = config['if_dim']
self.first_embedding_dim = config['first_embedding_dim']
self.sec... | 14,501 | 38.194595 | 117 | py |
TaNP | TaNP-main/TaNP/eval.py | """
Run evaluation with saved models.
"""
import random
import argparse
from tqdm import tqdm
import torch
from utils.scorer import *
def testing(trainer, opt, test_dataset):
test_dataset_len = len(test_dataset)
#batch_size = opt["batch_size"]
minibatch_size = 1
a, b, c, d = zip(*test_dataset)
tra... | 1,551 | 32.021277 | 100 | py |
TaNP | TaNP-main/TaNP/train_TaNP.py | import os
from datetime import datetime
import time
import numpy as np
import random
import argparse
import pickle
import torch
import torch.nn as nn
import torch.optim as optim
from torch.autograd import Variable
import json
from utils.loader import Preprocess
from TaNP import Trainer
from TaNP_training import trainin... | 7,850 | 47.462963 | 121 | py |
TaNP | TaNP-main/TaNP/TaNP.py | import torch
import numpy as np
from random import randint
from copy import deepcopy
from torch.autograd import Variable
from torch.nn import functional as F
from collections import OrderedDict
from embeddings_TaNP import Item, User, Encoder, MuSigmaEncoder, Decoder, Gating_Decoder, TaskEncoder, MemoryUnit
import torch... | 11,208 | 49.040179 | 168 | py |
TaNP | TaNP-main/TaNP/utils/scorer.py | import math
def AP(ranked_list, ground_truth, topn):
hits, sum_precs = 0, 0.0
t = [a for a in ground_truth]
t.sort(reverse=True)
t=t[:topn]
for i in range(topn):
id = ranked_list[i]
if ground_truth[id] in t:
hits += 1
sum_precs += hits / (i+1.0)
t... | 2,100 | 25.935897 | 89 | py |
TaNP | TaNP-main/TaNP/utils/helper.py | """
Helper functions.
"""
import os
import json
import argparse
### IO
def check_dir(d):
if not os.path.exists(d):
print("Directory {} does not exist. Exit.".format(d))
exit(1)
def check_files(files):
for f in files:
if f is not None and not os.path.exists(f):
print("Fil... | 1,713 | 21.853333 | 69 | py |
TaNP | TaNP-main/TaNP/utils/torch_utils.py | """
Utility functions for torch.
"""
import torch
from torch import nn, optim
from torch.optim.optimizer import Optimizer
### class
class MyAdagrad(Optimizer):
"""My modification of the Adagrad optimizer that allows to specify an initial
accumulater value. This mimics the behavior of the default Adagrad imple... | 5,696 | 32.710059 | 106 | py |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.