创建自定义攻击模块
AppSpider有超过50个内置的攻击模块。在某些情况下,用户可能希望创建特定于其环境的自定义攻击。因此,AppSpider提供了独特的功能,允许用户创建自定义攻击模块,以基于他们的应用环境探索新的攻击模块。
要创建自定义攻击模块,我们需要在Visual Studio Express中创建一个Library项目。这是一个来自微软的免费工具。可从以下连结下载:https://www.visualstudio.com/en-us/products/visual-studio-express-vs.aspx
创建自定义攻击模块
新图书馆项目
安装后,打开VS Express并创建一个新的类库项目。
从安装文件中添加一个引用dll (AttackerCOMLib.dll)。使用以下步骤在项目中添加一个新的引用ddl:
- 右键单击项目
- 导航到“添加”>>“参考”
- 点击“浏览”按钮
- 导航到“AttackerCom.dll”到AppSpider安装目录并选择它。
- 点击“添加”按钮
创建新类
现在,创建两个新的类ICSModule.cs和ICSModuleFactory.cs。使用以下步骤在VS Express中创建一个新类:
- 右键单击项目
- 导航到“添加”>>“新项目”
- 选择一个c#类项并将其命名为“ICSModule.cs”
- 同样,我们可以创建多个类文件
- 添加以下代码
ICSModule.cs:
1
使用系统;
2
3.
名称空间CustomModule
4
{
5
公共接口ICSModule
6
{
7
空负荷(使用uint moduleRunnerId);
8
9
使用uint CalculateNumberOfAttacks ();
10
bool RunAttack(使用uint attackIndex);
11
}
12
}
- 添加以下代码
CSModuleFactory.cs:
1
使用系统;
2
3.
名称空间CustomModule
4
{
5
公共接口ICSModuleFactory
6
{
7
bool CreateModule(Guid moduleGuid, out icmodule module); / /创建模块
8
}
9
}
- 添加一个新的类文件ModuleFactory.cs。在这个类中,我们需要添加一个惟一的GUID,它将用于在以后的Attack模块中附加。
1
使用系统;
2
使用AttackerCOMLib;
3.
使用包含;
4
5
名称空间CustomModule
6
{
7
公共类CSModuleFactory: ICSModuleFactory
8
{
9
public bool CreateModule(Guid moduleGuid, out ICSModule模块)
10
{
11
Guid correctGuid = new Guid("7DEE1967-063D-4BE0-8061-028D3E707FCE");
12
if (correctGuid == moduleGuid)
13
module = new Internal();
14
其他的
15
模块=零;
16
返回模块!= null;
17
}
18
19
}
20.
}
- 现在,添加一个
Internal.cs用下面的代码:
1
使用AttackerCOMLib;
2
使用系统;
3.
使用包含;
4
5
名称空间CustomModule
6
{
7
> / / / <总结
8
///内部模块名,根据module.cfg中指定的位置
9
> / / / < /总结
10
内部类:ICSModule
11
{
12
13
IModuleRunner _moduleRunner;
14
15
公共bool AttackPointIsRelevant ()
16
{
17
把新NotImplementedException ();
18
}
19
20.
公共使用uint CalculateNumberOfAttacks ()
21
{
22
IAttackPoint attackPoint = _moduleRunner.GetAttackPoint();
23
如果(attackPoint。类型= = AttackPointType.ATTACKPOINT_PARAMETER)
24
{
25
26
返回1;
27
}
28
其他的
29
{
30.
31
//其他攻击点是:
32
/ / CrawlResult
33
/ /文件
34
/ /目录
35
/ /主机
36
返回0;
37
}
38
}
39
40
41
42
public void Load(uint moduleRunnerId)
43
{
44
_moduleRunner = new ModuleRunner();
45
_moduleRunner.SetModuleInstanceID (moduleRunnerId);
46
}
- 在“C: Program Files (x86)\Rapid 7\AppSpider 6\ScanEngine\Modules”文件夹中新建一个“Internal”文件夹,放置一个“attack.cfg”和“module.cfg”文件夹。
- 编译并运行项目,它将生成一个“internal.dll”文件。复制并粘贴到“C: Program Files (x86)\Rapid 7\AppSpider 6\ScanEngine\Modules\internal”路径。
- 在“C: Program Files (x86)\Rapid 7\AppSpider 6\ScanEngine\Config\”路径下编辑“ApplicationPolicies.xml”文件。将以下代码添加到xml中。
1
< AttackModulePolicy >
2
<启用> 1 > < /启用
3.
ModuleId > < 7 dee1967063d4be08061028d3e707fce ModuleId > < /
4
< ModulePriority > < /媒介ModulePriority >
5
< >严重性信息> < /严重性
6
100年< MaxVulnLimit > < / MaxVulnLimit >
7
1 < MaxVarianceLimit > < / MaxVarianceLimit >
8
< PassiveAnalysisOnAttacks > 0 < / PassiveAnalysisOnAttacks >
9
< EnforceEncoding > 0 < / EnforceEncoding >
10
< AttackPoints >响应分析< / AttackPoints >
11
< ParameterLocations >目录| | |文件路径查询| Post Http头| | |片段饼干|引用页< / ParameterLocations >
12
AJAX < RequestOriginations > HTML表单| | | Flash | Silverlight | WSDL < / RequestOriginations >
13
< / AttackModulePolicy >
- 从AppSpider GUI创建一个新的扫描。导航到%Documents%/AppSpider/scans/Configname/config.scfg中的配置文件。
- 编辑配置文件并添加以下代码。
1
< AttackModulePolicy >
2
<启用> 1 > < /启用
3.
ModuleId > < 7 dee1967063d4be08061028d3e707fce ModuleId > < /
4
< ModulePriority > < /媒介ModulePriority >
5
<严重性> < / >严重程度低
6
100年< MaxVulnLimit > < / MaxVulnLimit >
7
1 < MaxVarianceLimit > < / MaxVarianceLimit >
8
< PassiveAnalysisOnAttacks > 0 < / PassiveAnalysisOnAttacks >
9
< EnforceEncoding > 0 < / EnforceEncoding >
10
参数< AttackPoints > < / AttackPoints >
11
< ParameterLocations >目录|文件查询| | |路径片段| |后饼干|引用页| Http头< / ParameterLocations >
12
AJAX < RequestOriginations > HTML表单| | | Flash | Silverlight | WSDL < / RequestOriginations >
13
< / AttackModulePolicy >
在攻击策略中可以看到新的攻击模块。
- 选择自定义攻击模块并运行扫描。
这个页面对你有帮助吗?