login-qr-line-qr-image
login qr line & qr image
python3 & linux ubuntu
api source: https://github.com/hert0t/BEAPI-BETA
import httpx
import qrcode
from PIL import Image
host = "https://beta.beapi.me"
http = httpx.Client(http2=True,timeout=120)
#don't forget to enter the logo you want to generate, rename it to fxglogo.jpg
def GenerateQRIMG(to,link):
Logo_link = 'fxglogo.jpg'
logo = Image.open(Logo_link)
basewidth = 100
wpercent = (basewidth/float(logo.size[0]))
hsize = int((float(logo.size[1])*float(wpercent)))
logo = logo.resize((basewidth, hsize), Image.ANTIALIAS)
QRcode = qrcode.QRCode( error_correction=qrcode.constants.ERROR_CORRECT_H)
url = str(link)
QRcode.add_data(url)
QRcode.make()
QRcolor = 'Black'
QRimg = QRcode.make_image(fill_color=QRcolor, back_color="white").convert('RGB')
pos = ((QRimg.size[0] - logo.size[0]) // 2, (QRimg.size[1] - logo.size[1]) // 2)
QRimg.paste(logo, pos)
QRimg.save('scanme.png')
alip.sendImage(to, 'scanme.png')
os.system("rm -r scanme.png")
def lineGetQr(appName,cert=""):
params = {"appname": appName}
if cert != "":params["cert"] = cert
resp = http.get(host+"/lineqr",params=params).json()
if resp["status"] != 200: raise Exception (resp["reason"])
return resp
def lineGetQrPincode(session):
resp = http.get(host+"/lineqr/pincode/"+session).json()
if resp["status"] != 200: raise Exception (resp["reason"])
return resp
def lineGetQrAuth(self, session):
resp = http.get(host+"/lineqr/auth/"+session).json()
if resp["status"] != 200: raise Exception (resp["reason"])
return resp
#LOGIN non cert
#headers > "IOSIPAD\t10.5.2\tiPhone 8\t11.2.5"
def LoginQR(headers, cert=""):
qr = lineGetQr(headers,cert)
cl.sendMessage(to,"Link QR: "+qr["result"]["qrlink"])
GenerateQRIMG(to,qr["result"]["qrcode"])
cl.sendMessage(to,"IP: "+qr["result"]["ip"])
if crt == "":
pincode = lineGetQrPincode(qr["result"]["session"])
cl.sendMessage(to,"Pincode: "+pincode["result"]["pincode"])
auth = lineGetQrAuth(qr["result"]["session"])
print("Cert: "+auth["result"]["certificate"])
return auth["result"]["accessToken"]
for login using def LoginQR
if cmd.startswith("login "):
sep = text.split(" ")
fxgsetup = text.replace(sep[0] + " ", "")
# login header desktopwin, dekstopmac, chromeos
if fxgsetup == "desktopwin":
x = LoginQR("DESKTOPWIN\t7.4.0\tPC-9bujIF\t10")
#x is access toke, you can use os.system for deploy your bot.
elif fxgsetup == "desktopmac":
x = LoginQR("DESKTOPMAC\t7.4.0\tPC-9bujIF\t10")
#x is access toke, you can use os.system for deploy your bot.
elif fxgsetup == "chromeos":
x = LoginQR("CHROMEOS\t2.4.9\tChrome OS\t1")
#x is access toke, you can use os.system for deploy your bot.
else:
cl.sendMessage(to, "headers not in list login")
if you have cert and want login with cert.
if cmd.startswith("login "):
cert = "012324434353453454565768786785774546" # << your cert code
sep = text.split(" ")
fxgsetup = text.replace(sep[0] + " ", "")
# login header desktopwin, dekstopmac, chromeos
if fxgsetup == "desktopwin":
x = LoginQR("DESKTOPWIN\t7.4.0\tPC-9bujIF\t10",cert)
#x is access token, you can use os.system for deploy your bot.
elif fxgsetup == "desktopmac":
x = LoginQR("DESKTOPMAC\t7.4.0\tPC-9bujIF\t10",cert)
#x is access token, you can use os.system for deploy your bot.
elif fxgsetup == "chromeos":
x = LoginQR("CHROMEOS\t2.4.9\tChrome OS\t1",cert)
#x is access token, you can use os.system for deploy your bot.
else:
cl.sendMessage(to, "headers not in list login")