powershell

Can i use existing variables in powershell read-host

柔情痞子 提交于 2021-01-18 07:17:05
问题 i am writing a simple script in powershell using "read-host -prompt" so that i can input some text that will then be used to create some environment variables. Is there a way that the subsequent times the script is run, the read-host message will show an existing value for the variable if it exists ? and if not what i want then accept my new input to change that variable ? for example ... $myvar = read-host -prompt "whats your value" and i enter 10 to set $myvar value to 10 next time the

红队武器库-网络安全人员必备

穿精又带淫゛_ 提交于 2021-01-18 06:00:01
包含内容: 侦察 武器化 投递 命令与控制 横向移动 建立立足点 提权 数据传输 杂项 内容很不错,建议转发朋友圈作为存档。 侦察 主动情报收集 EyeWitness is designed to take screenshots of websites, provide some server header info, and identify default credentials if possible. https://github.com/ChrisTruncer/EyeWitness AWSBucketDump is a tool to quickly enumerate AWS S3 buckets to look for loot. https://github.com/jordanpotti/AWSBucketDump AQUATONE is a set of tools for performing reconnaissance on domain names. https://github.com/michenriksen/aquatone spoofcheck a program that checks if a domain can be spoofed from. The program checks SPF and DMARC records for

How to create a wrapper for an advanced function cmdlet that uses dynamic parameters

╄→尐↘猪︶ㄣ 提交于 2021-01-16 04:18:56
问题 I'm trying to create a wrapper (proxy) for Pester's Should cmdlet. Possible use cases include transparent logging of test input even in case of success and improve the way Pester logs objects of certain types, e. g. hashtable. As Should is an advanced function, forwarding arguments via $args splatting does not work. So I tried to generate a wrapper using System.Management.Automation.ProxyCommand::Create() , as described by this answer: $cmd = Get-Command Should $wrapperSource = [System

How to create a wrapper for an advanced function cmdlet that uses dynamic parameters

ぃ、小莉子 提交于 2021-01-16 04:14:08
问题 I'm trying to create a wrapper (proxy) for Pester's Should cmdlet. Possible use cases include transparent logging of test input even in case of success and improve the way Pester logs objects of certain types, e. g. hashtable. As Should is an advanced function, forwarding arguments via $args splatting does not work. So I tried to generate a wrapper using System.Management.Automation.ProxyCommand::Create() , as described by this answer: $cmd = Get-Command Should $wrapperSource = [System

How to create a wrapper for an advanced function cmdlet that uses dynamic parameters

怎甘沉沦 提交于 2021-01-16 04:12:50
问题 I'm trying to create a wrapper (proxy) for Pester's Should cmdlet. Possible use cases include transparent logging of test input even in case of success and improve the way Pester logs objects of certain types, e. g. hashtable. As Should is an advanced function, forwarding arguments via $args splatting does not work. So I tried to generate a wrapper using System.Management.Automation.ProxyCommand::Create() , as described by this answer: $cmd = Get-Command Should $wrapperSource = [System

How to create a wrapper for an advanced function cmdlet that uses dynamic parameters

。_饼干妹妹 提交于 2021-01-16 04:12:36
问题 I'm trying to create a wrapper (proxy) for Pester's Should cmdlet. Possible use cases include transparent logging of test input even in case of success and improve the way Pester logs objects of certain types, e. g. hashtable. As Should is an advanced function, forwarding arguments via $args splatting does not work. So I tried to generate a wrapper using System.Management.Automation.ProxyCommand::Create() , as described by this answer: $cmd = Get-Command Should $wrapperSource = [System

IP相关

≯℡__Kan透↙ 提交于 2021-01-15 16:15:31
1. Rename a Network Interface from the Command Line netsh interface ip show interfaces netsh interface set interface name = "Local Area Connection 5" newname = "iSCSI1" 2. Configure IP/GW/DNS Set IP/GW: netsh interface ip show interfaces netsh interface ip set address "Ethernet0 2" source=static 10.24.101.19 255.255.0.0 10.24.255.254 Set DNS: netsh interface ip set dnsservers "Ethernet0 2" static 10.110.1.13 Add second DNS: netsh interface ip add dnsservers "Ethernet0 2" 10.110.1.14 Add second IP: netsh interface ip add address "Ethernet0 2" 10.24.101.18 255.255.0.0 3. Disable IPv6 Using

Powershell如何远程 添加管理员

自古美人都是妖i 提交于 2021-01-15 11:16:45
Powershell远程添加管理员 Write-Host "添加远程管理员,请输入主机及AD域账号" $DomainName = "XXX.com" $ComputerName = Read-Host "Computer name:" $UserName = Read-Host "User name:" $AdminGroup = [ADSI]"WinNT://$ComputerName/Administrators,group" $User = [ADSI]"WinNT://$DomainName/$UserName,user" $AdminGroup.Add($User.Path) 来源: oschina 链接: https://my.oschina.net/u/4295062/blog/4899840

如何快速往cloud shell中传送文件

自作多情 提交于 2021-01-15 09:08:58
今天来分享一个小技巧,关于cloud shell的,cloud shell是个不错的工具,尤其是在一个应急的情况,本地安装CLI或者PowerShell都需要时间和权限,但是cloud shell是个现成的命令行环境,还内置像vscode、terraform、Ansible这种工具,非常方便,比较遗憾的是目前还是只有Global Azure才有 但是有个问题其实一直让我觉得比较麻烦,就是怎么把一些文件快速传到cloud shell里去,有一些脚本或者文件在本地写好之后想放到cloud shell里去运行,但是一个个编辑实在麻烦,研究了一下之后逐渐发现了一些技巧 像这种共享文件有一个比较好用的方式其实就是azure file,可以直接支持挂载,经过研究之后发现,其实cloud shell里内置了一个叫clouddrive的程序,这个程序就可以用来挂载azure file,首先打开cloud shell,在global azure的右上角有个小按钮 打开之后根目录就会有一个clouddrive的程序 使用clouddrive mount 指定好订阅、storage和file share的名字之后很简单就可以连接到这个file share,当然需要注意这个file share需要和cloud shell在同一个region 这里要提醒的一点是,cloud shell之所以能够保存文件

【更新】新型勒索软件WannaRen风险通告

老子叫甜甜 提交于 2021-01-14 14:02:22
0x00 漏洞背景 2020年04月07日, 360CERT监测发现网络上出现一款新型勒索软件 WannaRen ,该勒索软件会加密 Windows 系统中几乎任何文件,并且以 .WannaRen 后缀命名。 0x01 风险等级 360CERT对该事件进行评定 评定方式 等级 威胁等级 高危 影响面 广泛 360CERT建议广大用户及时安装 安全防护软件 。做好资产 自查/自检/预防 工作,以免遭受攻击。 0x02 事件详情 在运行该勒索软件后会弹出如下界面 目前捕获到的比特币地址为: 1NXTgfGprVktuokv3ZLhGCPCjcKjXbswAM 0x03 细节分析 2020-04-08更新 经360安全大脑分析确认,“WannaRen”勒索病毒的作者正是此前借“永恒之蓝”漏洞祸乱网络的“匿影”组织。 在攻击特征上,“匿影”黑客团伙主要利用BT下载器、激活工具等传播,也曾出现过借“永恒之蓝”漏洞在局域网中横向移动扩散的情况。“匿影”黑客团伙在成功入侵目标计算机后,通常会执行一个PowerShell下载器,利用该加载器下载下一阶段的后门模块与挖矿木马 PowerShell下载器部分代码: 此次新型比特币勒索病毒“WannaRen”的扩散活动中,从表面看与此前的“WannaCry”病毒类似,都是病毒入侵电脑后,弹出勒索对话框,告知已加密文件并向用户索要比特币