How to use the aioblescan.String function in aioblescan

To help you get started, we’ve selected a few aioblescan examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github frawau / aioblescan / aioblescan / plugins / eddystone.py View on Github external
url_schemes.index((myurl.scheme,myhostname.startswith("www.")))))
            if myhostname.startswith("www."):
                myhostname = myhostname[4:]
        extval=None
        if myhostname.split(".")[-1] in url_domain:
            extval = url_domain.index(myhostname.split(".")[-1])
            myhostname = ".".join(myhostname.split(".")[:-1])
        if extval is not None and not mypath.startswith("/"):
            extval+=7
        else:
            if myurl.port is None:
                if extval is not None:
                    mypath = mypath[1:]
            else:
                extval += 7
        encodedurl.append(aios.String("URL string"))
        encodedurl[-1].val = myhostname
        if extval is not None:
            encodedurl.append(aios.IntByte("URL Extention",extval))

        if myurl.port:
            asisurl += ":"+str(myurl.port)+mypath
        asisurl += mypath
        if myurl.params:
            asisurl += ";"+myurl.params
        if myurl.query:
            asisurl += "?"+myurl.query
        if myurl.fragment:
            asisurl += "#"+myurl.fragment
        encodedurl.append(aios.String("Rest of URL"))
        encodedurl[-1].val = asisurl
        tlength=0
github frawau / aioblescan / aioblescan / plugins / eddystone.py View on Github external
extval += 7
        encodedurl.append(aios.String("URL string"))
        encodedurl[-1].val = myhostname
        if extval is not None:
            encodedurl.append(aios.IntByte("URL Extention",extval))

        if myurl.port:
            asisurl += ":"+str(myurl.port)+mypath
        asisurl += mypath
        if myurl.params:
            asisurl += ";"+myurl.params
        if myurl.query:
            asisurl += "?"+myurl.query
        if myurl.fragment:
            asisurl += "#"+myurl.fragment
        encodedurl.append(aios.String("Rest of URL"))
        encodedurl[-1].val = asisurl
        tlength=0
        for x in encodedurl: #Check the payload length
            tlength += len(x)
        if tlength > 19: #Actually 18 but we have tx power
            raise Exception("Encoded url too long (max 18 bytes)")
        self.service_data_length.val += tlength #Update the payload length
        return encodedurl
github frawau / aioblescan / aioblescan / plugins / eddystone.py View on Github external
result["url"]+=".com"
                elif bytes([x]) == b"\x08":
                    result["url"]+=".org"
                elif bytes([x]) == b"\x09":
                    result["url"]+=".edu"
                elif bytes([x]) == b"\x10":
                    result["url"]+=".net"
                elif bytes([x]) == b"\x11":
                    result["url"]+=".info"
                elif bytes([x]) == b"\x12":
                    result["url"]+=".biz"
                elif bytes([x]) == b"\x13":
                    result["url"]+=".gov"
                else:
                    result["url"]+=chr(x) #x.decode("ascii") #Yep ASCII only
                    url=aios.String("url")
            url.decode(result["url"])
            found.payload.append(url)
        elif etype.val== ESType.tlm.value:
            myinfo=aios.IntByte("version")
            data=myinfo.decode(data)
            found.payload.append(myinfo)
            myinfo=aios.ShortInt("battery")
            data=myinfo.decode(data)
            result["battery"]=myinfo.val
            found.payload.append(myinfo)
            myinfo=aios.Float88("temperature")
            data=myinfo.decode(data)
            found.payload.append(myinfo)
            result["temperature"]=myinfo.val
            myinfo=aios.LongInt("pdu count")
            data=myinfo.decode(data)