Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

Python 

Kleenscan API Scanner

Hello everyone,

I coded this tool in order to ease the scanning progress and wanted to contribute more to this website.

Scans with 19 antiviruses - Adaware, Amiti, Arcabit, Avast, AVG, Bitdefender, Comodo, Fsecure, Immunet, Sophos, Clamav, Norman, Bullguard, Gdata, Kaspersky, Maxsecure, Mcafee, Nod32 and Microsoft Defender.

Prerequisites
Kleenscan account
Requests library (use pip install)

Code
from requests import get, post
from os.path import isfile
from json import loads
from time import sleep

TOKEN = "your token here"


def main():
    prog = input("Enter program name > ")

    if not isfile(prog):
        print("Invalid file!")
        main()
        return

    prog = {"path": open(prog, "rb")}
    data = {"avList": "adaware,amiti,arcabit,avast,avg,bitdefender,comodo,fsecure,immunet,sophos,clamav,norman,"
                      "bullguard,gdata,kaspersky,maxsecure,mcafee,nod32,microsoftdefender"}

    print("Uploading file..")

    req = post("https://kleenscan.com/api/v1/file/scan", files=prog, data=data, headers={"X-Auth-Token": TOKEN})
    req = req.text

    if "account balance" in req:
        print("Can't scan - account balance is too low.")
        return

    scan_token = req.find("scan_token")

    if scan_token == -1:
        print("Something went wrong! No scan token.")
        return

    scan_token += 13
    scan_token = req[scan_token:len(req)-3]

    print("Sleeping for a bit for scans to complete..")
    sleep(25)

    req = get(f"https://kleenscan.com/api/v1/file/result/{scan_token}", headers={"X-Auth-Token": TOKEN})
    result = loads(req.text)["data"]

    num_detected = 0
    total_scans = 0

    for data in result:

        total_scans += 1

        avname = data["avname"][0].upper() + data["avname"][1:]
        status = data["status"]
        flagname = data["flagname"]

        if status != "ok":
            print(f"AV: {avname} -> Could not scan")
        else:
            print(f"AV: {avname} -> {flagname}")

        if flagname != "Undetected":
            num_detected += 1

    print(f"Total: {str(num_detected)}/{str(total_scans)}")


main()

[Image: e7o4YbW.png]

To use, just edit the TOKEN variable with your API token at the top of the file, place your PE in the same directory and type in the file name.

Hope this helps.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by SIM-4704770Jun 2, 2022 01:54 AM 4 361 Jun 2, 2022 01:54 AM
Last Post: SIM-4704770
[C#] by SIM-4704770Mar 6, 2021 09:40 AM 10 619 Mar 6, 2021 09:40 AM
Last Post: SIM-4704770
[Java] by GlushkoJun 13, 2018 11:13 PM 3 641 Jun 13, 2018 11:13 PM
Last Post: hostov