Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Net;
- using System.Net.Http;
- using System.Net.Http.Headers;
- using System.Text;
- namespace Test1111
- {
- class Program
- {
- public static string key = "";
- public static async System.Threading.Tasks.Task ReportAsync(string hostname, string comment, bool hacking, bool brute, bool webapp_h, bool scanning, bool ddos)
- {
- string bad = "";
- if (hacking)
- {
- bad += "15,";
- }
- if (brute)
- {
- bad += "18,5,";
- }
- if (webapp_h)
- {
- bad += "21,";
- }
- if (scanning)
- {
- bad += "14,";
- }
- if (ddos)
- {
- bad += "4,";
- }
- bad = bad.Substring(0, bad.Length - 1);
- try
- {
- using (var httpClient = new HttpClient())
- {
- using (var request = new HttpRequestMessage(new HttpMethod("POST"), "https://api.abuseipdb.com/api/v2/report"))
- {
- request.Headers.TryAddWithoutValidation("Key", key);
- request.Headers.TryAddWithoutValidation("Accept", "application/json");
- var contentList = new List<string>();
- contentList.Add($"ip={Uri.EscapeDataString(hostname)}");
- contentList.Add("categories=" + bad);
- contentList.Add($"comment={Uri.EscapeDataString(comment)}");
- request.Content = new StringContent(string.Join("&", contentList));
- request.Content.Headers.ContentType = new MediaTypeHeaderValue("application/x-www-form-urlencoded");
- Console.WriteLine("=== REPORTING IP.... " + hostname);
- var response = await httpClient.SendAsync(request);
- if (response.StatusCode == HttpStatusCode.OK)
- {
- Console.WriteLine("=== REPORTED IP " + hostname);
- }
- else
- {
- Console.WriteLine("=== ERROR WHILE REPORTING: " + response.StatusCode.ToString());
- Console.WriteLine("=== " + response.Content.ToString());
- }
- }
- }
- }
- catch (Exception e)
- {
- Console.WriteLine(e.StackTrace);
- }
- }
- static void Main(string[] args)
- {
- var a = ReportAsync("127.0.0.1", "IP Spoofing attempt using CONNECT/GET requests", true, false, true, false, false);
- Console.ReadLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement