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

C# 

Kleenscan API In CSharp

I recently bought kleenscan and wanted to add it to my c# applications, here is the code I used.
Code
using(var httpClient = new HttpClient()) {
  using(var request = new HttpRequestMessage(new HttpMethod("POST"), "https://kleenscan.com/api/v1/file/scan")) {
    var multipartContent = new MultipartFormDataContent {
      {
        new ByteArrayContent(File.ReadAllBytes("your_file_path_here")),
        "path",
        Path.GetFileName("your_file_path_here")
      },
      {
        new StringContent("avast,avg"),
        "avList"
      }
    };
    request.Content = multipartContent;
    request.Headers.Add("X-Auth-Token", "Your Authentication Token Here");
    var response = await httpClient.SendAsync(request);
    string resp = JsonConvert.DeserializeObject(response.Content.ReadAsStringAsync().Result).ToString();
  }
}
Successful response, containing the scan_token looks like this:
Code
"success" => true
"error_message" => "";
"data" => [
"scan_token" => "bc0890be7133616e68f5d81207cca045"
]
This is just for uploading files, which a lot of people seem to be having a hard time with. Getting avlist and results is easy enough.
That's pretty nice! The kleenscan api is really nice to use, I'm using it for my free AV scanner website too!

One thing to keep in mind about this c# version is that if you include your api key in your application, other people will be able to extract it and use it themselves!
Yeah I found that to be a problem, I'm adding it as a addon that you can purchase from kleenscan separately, or possibly I could make a deal with kleenscan where I get bulk accounts so that I can give every client their own personal key as part of purchasing my crypter.
(Dec 12, 2020 09:20 AM)SIM-4704770 Wrote:  Yeah I found that to be a problem, I'm adding it as a addon that you can purchase from kleenscan separately, or possibly I could make a deal with kleenscan where I get bulk accounts so that I can give every client their own personal key as part of purchasing my crypter.

I mean, i doubt that kleenscan would go for this. The secure way of providing scans in your crypter is to do those scans server side on your own server.

This way you can easily limit scans per customer (based on their license id) to something like 100 scans per week, without giving away your kleenscan API key.
Nice share,
will be helpful for many HF users.
[Image: 6xBycLk.gif]

Website: nomorehome.work
(Dec 13, 2020 01:47 AM)neon_light Wrote:  I mean, i doubt that kleenscan would go for this. The secure way of providing scans in your crypter is to do those scans server side on your own server.

This way you can easily limit scans per customer (based on their license id) to something like 100 scans per week, without giving away your kleenscan API key.

Well I believe that they would go for me just adding their api into it allowing for people to buy kleenscan and use it together with my products. I do get what your saying.
(Dec 11, 2020 08:07 PM)SIM-4704770 Wrote:  I recently bought kleenscan and wanted to add it to my c# applications, here is the code I used.
Code
using(var httpClient = new HttpClient()) {
  using(var request = new HttpRequestMessage(new HttpMethod("POST"), "https://kleenscan.com/api/v1/file/scan")) {
    var multipartContent = new MultipartFormDataContent {
      {
        new ByteArrayContent(File.ReadAllBytes("your_file_path_here")),
        "path",
        Path.GetFileName("your_file_path_here")
      },
      {
        new StringContent("avast,avg"),
        "avList"
      }
    };
    request.Content = multipartContent;
    request.Headers.Add("X-Auth-Token", "Your Authentication Token Here");
    var response = await httpClient.SendAsync(request);
    string resp = JsonConvert.DeserializeObject(response.Content.ReadAsStringAsync().Result).ToString();
  }
}
Successful response, containing the scan_token looks like this:
Code
"success" => true
"error_message" => "";
"data" => [
"scan_token" => "bc0890be7133616e68f5d81207cca045"
]
This is just for uploading files, which a lot of people seem to be having a hard time with. Getting avlist and results is easy enough.

thought you didn't have btc to refund me....
You're just uploading a PE to a remote cloud which runs a scan on their side using AVG and Avast (according to your params). Why not just reference people here to their api instead of writing a wrapper on top of it?
(Dec 21, 2020 07:42 AM)riu41776 Wrote:  You're just uploading a PE to a remote cloud which runs a scan on their side using AVG and Avast (according to your params).

It's probably just meant as an example. Most people will stick with "all"


(Dec 21, 2020 07:42 AM)riu41776 Wrote:  Why not just reference people here to their api instead of writing a wrapper on top of it?


People that want to use the kleenscan API probably already know those API docs. People looking for help with c# examples probably just dont know how to use their api within C#, so an example like from OP could help them implement it.
Nice work, great job :)
Kleenscan https://www.kleenscan.biz Multi AV Scanner
Yeah no problem, I didn't see it on your documentation area, so I just wanted it to be released somewhere, to help people who don't understand api usage in c#.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[C#] by SIM-4704770Jun 2, 2022 01:54 AM 4 358 Jun 2, 2022 01:54 AM
Last Post: SIM-4704770
[Python] by Mr RobotoJun 1, 2022 02:12 PM 0 231 Jun 1, 2022 02:12 PM
Last Post: Mr Roboto
[C#] by umaymamekhlafyFeb 6, 2019 11:13 AM 1 218 Feb 6, 2019 11:13 AM
Last Post: Fhack