-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
84 lines (75 loc) · 2.84 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Xml;
using System.Text.RegularExpressions;
using HttpWebRequestExecutor.Interfaces;
using HttpWebRequestExecutor.Factories;
using System.Net;
using HttpParser.Models;
using System.Xml;
namespace MicroFocus_Scanner
{
class Program
{
private static IHttpWebRequestFactory factory;
static void Main(string[] args)
{
string file_path;
string errors_path;
string param_pholder;
if (args.Length >= 1)
{
file_path = args[0];
}
else
{
file_path = "C:\\Users\\IEUser\\Desktop\\req_blab.txt";
Console.WriteLine("No request file was provided; will use the development values! " + file_path);
}
if (args.Length >= 2)
{
param_pholder = args[1];
}
else
{
param_pholder = "\\$\\w+\\$";
Console.WriteLine("No request file was provided; will use the development values! " + param_pholder);
}
string text = System.IO.File.ReadAllText(@file_path);
//Console.Write(text);
factory = new HttpWebRequestFactory();
Request req = new Request(text, factory, param_pholder);
IGenPayload xssPayloadGenerator = new XSSPayloadGenerator();
IErrorLoader xssErrorLoader = new XSSErrors(xssPayloadGenerator.GeneratePayload());
Request req2 = new Request(text, factory, param_pholder);
IAttack xssAttack = new Attack("XSS Injection", xssPayloadGenerator, req2, xssErrorLoader);
string res_msg2 = xssAttack.run_attack();
Console.WriteLine(res_msg2);
XmlDocument XDoc = null;
IErrorLoader sqlXMLLoader = null;
if (args.Length < 3)
{
XDoc = new XmlDocument();
XDoc.LoadXml(Resources.MSSQL_Errors);
sqlXMLLoader = new XmlErrorLoader(XDoc, "checks");
}
else
{
errors_path = args[2];
sqlXMLLoader = new XmlErrorLoader(errors_path, "checks");
}
IGenPayload sqlPGenerator = new SQLIPayload();
IAttack sqlAttack = new Attack("SQL Injection", sqlPGenerator, req, sqlXMLLoader);
string res_msg = sqlAttack.run_attack();
Console.WriteLine(res_msg);
}
static async Task run_transport(String text)
{
Transport tcp_t = new Transport("http://10.0.2.15/Hackathon/Account/Login.aspx");
await tcp_t.ConnectAsync(text);
}
}
}