CobaltStrike插件开发-learning-day2

day2

还是在sleep.jar里操作,承接上文链接

函数引用

println("-----函数引用------------------");
$addf = &addTwoValues;
[$addf : "3", 55.0];
[&addTwoValues : "3", 55.0];
[{ println($1 + $2); } : "3", 55.0];

while循环

println("-----while------------------");
$a = 0;
while ($a lt 6){
	println($a);
	$a = $a + 1;
}

for循环

println("-----for------------------");
$a = 0;
for ($i = 1; $i lt 6 ; $i++){
	println($a);
	$a = $a + 1;
}

agscript

在C2里加载插件

交互式操作

command foo {
    println("Hello $1");
}

控制台文本颜色

\c 控制文本颜色

println("\c0This is my color");
println("\c1This is my color");
println("\c2This is my color");
println("\c3This is my color");
println("\c4This is my color");
println("\c5This is my color");
println("\c6This is my color");
println("\c7This is my color");
println("\c8This is my color");
println("\c9This is my color");
println("\cAThis is my color");
println("\cBThis is my color");
println("\cCThis is my color");
println("\cDThis is my color");
println("\cEThis is my color");
println("\cFThis is my color");

数据模型

C2自身提供的函数,可供脚本调用,如获取上线机器的信息,通过以下代码获取

println("-------------数据模型--------");
command export {
	local('$handle $model $row $entry $index');
	$handle = openf(">export.txt");
	
	foreach $model (data_keys()) {
		println($handle, "== $model ==");
		println($handle, data_query($model));
	}
	
	closef($handle);
	
	println("See export.txt for the data.");
}

 

在导出的txt可以搜索到其中的数据模型信息,比如搜索socks

 x users()

x targets()

x beacon_ids()

x beacons()

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值