powershell

Get a specific octet from the string representation of an IPv4 address

假装没事ソ 提交于 2021-02-16 09:31:19
问题 I have a variable named $Ip . This variable has an IP inside like "172.13.23.34". I would like to get the 3rd octet or the next character between 172.13. and .34 which is a string number 23 in this case and store in another variable to set up a VLANID with the command below. $Ip = 172.13.23.34 $VLANID = ? Set-Netadapter -Name "Ethernet" -VlanID $VLANID How can I get this specific information? 回答1: While -split, the regex-based string-splitting operator , or the literal-substring-based Split()

Get a specific octet from the string representation of an IPv4 address

给你一囗甜甜゛ 提交于 2021-02-16 09:31:05
问题 I have a variable named $Ip . This variable has an IP inside like "172.13.23.34". I would like to get the 3rd octet or the next character between 172.13. and .34 which is a string number 23 in this case and store in another variable to set up a VLANID with the command below. $Ip = 172.13.23.34 $VLANID = ? Set-Netadapter -Name "Ethernet" -VlanID $VLANID How can I get this specific information? 回答1: While -split, the regex-based string-splitting operator , or the literal-substring-based Split()

Powershell + HTA

断了今生、忘了曾经 提交于 2021-02-16 05:38:03
众所周知,Powershell早已被集成到了windows的环境中,国外大牛玩得不亦乐乎,而国内圈子却很少听到讨论Powershell的,HTA更不用说了,不是学计算机的或许根本不知道这是什么鬼 Linux下有bash,Windows下有Powershell。Powershell依靠在.NET这个大树下,因此也有了比如直接调用windowsAPI等强大功能和利用价值。 Powershell 脚本后缀名为ps1,这种格式不像bat、vbs、exe等双击执行,而是需要经由powershell.exe启动,可以直接使用: PowerShell.exe -ExecutionPolicy Bypass -File .\script.ps1 在win7和server08后,Powershell被集成在系统中,此举方便了服务器的管理,同样,过分的的强大也让自己危险了很多。 HTA hta格式,看上去一个陌生的后缀,但实际遨游网络的你天天都接触到,因为它也是网页格式的一种,类似于html/htm ,通过html语法编写内容。 HTA是HTML-Application的缩写,是软件开发的新概念,直接将某个html页面保存成hta的格式,就是一个独立的应用软件,点开与网页内容并无区别,界面与VB、C++等程序语言所设计的软件界面没什么差别,显示为窗口交互界面。 相关内容: HTA_百度百科 就是个网页

Empire – PowerShell 后渗透攻击框架

别说谁变了你拦得住时间么 提交于 2021-02-15 09:34:55
0x01 简介 Empire是一个后渗透攻击框架。它是一个纯粹的PowerShell代理,具有加密安全通信和灵活架构的附加功能。Empire具有在不需要PowerShell.exe的情况下执行PowerShell代理的方法。它可以迅速采用可后期利用的模块,涵盖范围广泛,从键盘记录器到mimikatz等。这个框架是PowerShell Empire和Python Empire项目的组合; 这使得它用户友好和方便。PowerShell Empire于2015年问世,Python Empire于2016年问世。它类似于Metasploit和Meterpreter。但由于它是命令和控制工具,它允许您更有效地控制PC。 PowerShell提供了丰富的攻击性优势,进一步包括.NET的全部访问,applock白名单以及对Win32的直接访问。它还在内存中构建恶意二进制文件。它提供C2功能,允许您在第一阶段之后植入第二阶段。它也可以用于横向移动。它与其他框架相比发展迅速,且非常方便。此外,由于它不需要PowerShell.exe,它可以让您绕过反病毒。因此,最好使用PowerShell Empire。 0x02 功能 listenter:监听器是一个从我们正在攻击的机器上侦听连接的进程。这有助于Empire将战利品发回攻击者的计算机。 Stager: stager是一段代码

PowerShell渗透--Empire

依然范特西╮ 提交于 2021-02-15 07:33:56
0x00 简介 Empire是一款针对Windows平台的,使用PowerShell脚本作为攻击载荷的渗透攻击框架代码具有从stager生成,提权到渗透维持的一系列功能,无需powershell.exe就可以使用powershell的代理功能还可以快速在后期部署漏洞利用模块,内置模块有键盘记录,Mimikatz,绕过UAC,内网扫描等,可以躲避网络检测和大部分安全防护工具,类似于Meterpreter,是一个基于PowerShell的远控木马( www.powershellempire.com ) 0x02 安装 git clone https://github.com/EmpireProject/Empire.git 0x03 使用 help 查看帮助 设置监听 listeners #进入监听线程界面 uselistener #设置监听模式 info #查看具体参数设置 set #设置相应参数 execute #开始监听 uselistener 用来设置监听模式 uselistener <tab> <tab> 查看可以使用的监听模式 uselistener http 采用http监听模式,输入info 查看具体参数设置 Required 为 true 的参数都是需要设置的 set Name Micr067 #设置任务名称 set Host 192.168.190.133 #

Make SQL*Plus script quit

跟風遠走 提交于 2021-02-15 07:08:14
问题 I have a few SQL*Plus scripts in a directory that I would like to run automatically using powershell. I can read the directory and but when I tried to execute the script, the scripts terminated but did not quit powershell and go to the next one. How do I make powershell quit SQL*Plus and go to the next script automatically without me modifying the scripts by explicitly adding a quit at the end of each script? Below is the illustrated powershell script in its simplest form $Filename=Get

Windows 命令行终端 PowerShell 美化计划

▼魔方 西西 提交于 2021-02-15 06:23:07
1. 前言 欢迎加入[ 微信圈子 ] 程序员交流圈 交流编程经验。 作为一个程序员,终端工具是必不可少的。但是 「Windows」 的默认终端实在太丑了,作为一个颜控忍不了。所以必须实施终端改造计划。目前我们都会使用 「PowerShell」 ,所以改造计划就先从它开始。先看看我改造的效果: ❝ 本文涉及的所有命令都在 「管理员模式」 的 「PowerShell」 下执行。 ❞ 2. 安装 Chocolatey 「homebrew」 很多使用 「Mac」 的同学都用过,很方便的软件包管理工具。一行命令就可以安装很多我们需要的开发软件,比如 「Maven」 、 「JDK」 等,命令非常简单,比如我们从软件仓库查找一下 「JDK」 : 安装 「Chocolatey」 的命令为: Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iwr https://chocolatey.org/install.ps1 -UseBasicParsing | iex 3. 改造字体 第一步就是改造字体,默认的 「新宋体」

初识powershell、nuget powershell 调试

江枫思渺然 提交于 2021-02-15 01:23:12
初识powershell、nuget powershell 调试 补充 此文仅当做powershell的初步认识体验,关于nuget包里此脚本的使用官方已在vs2017停止支持, 请看此文文末 前言 老早就听说powershell很牛逼,但是没真正用过,这两天刚好用到,顺便写一下有关的,可能以后用得到的东西。本来想记一下这次使用过程中用到的一些操作的,就是这么巧,发现了个很不错的教程网站,于是我就可以偷懒了,哈哈。 相关资料 非官方在线教程网站 www.pstips.net 官方文档 入门 基本指南 操作系统要求 Windows PowerShell ISE 运行远程命令 在nuget安装包的时候进行powershell调试 调试相关 在项目需要用到nuget包 NuGetDebugTools 按照github上 教程 操作 程序包管理器控制台输入相关命令,在安装需要调试的nuget包的时候就会弹出一个输入框和powershell控制台,输入框内输入命令可进行调试操作,还可以输入变量或者表达式以便在powershell控制台观察结果 添加调试器 Add-Debugger 或者 Add-Debugger -ReadHost 设置需要调试的脚本名 Set-PSBreakpoint -Command init.ps1, install.ps1, uninstall.ps1 新建项目

Powershell学习笔记:(一)、初识Powershell

我的未来我决定 提交于 2021-02-15 00:02:57
什么是Powershell? MSDN上的说明是: PowerShell 是构建于 .NET 上基于任务的命令行 shell 和脚本语言。 PowerShell 可帮助系统管理员和高级用户快速自动执行用于管理操作系统(Linux、macOS 和 Windows)和流程的任务。 使用 PowerShell 命令可以从命令行管理计算机。 PowerShell 提供程序可让你访问数据存储(如注册表和证书存储),与你访问文件系统一样方便。 PowerShell 具有丰富的表达式分析器和完全开发的脚本语言。 个人理解为Powershell就是一门脚本语言,类似于Linux下的shell语言。与传统cmd命令不同的是,Powershell不仅能调用cmd下的命令,还增加了非常多的新命令,同时Powershell面向对象的(基于.Net)。 使用PowerShell可以完成许多自动化管理。PowerShell增加了对Windows10、Window Server2016、SQL Server、Azure的管理模块。Windows PowerShell是开源的,我们可以在Github上找到它的源代码 https://github.com/PowerShell/PowerShell 启动Powershell 1、开始菜单=》运行=》输入Powershell 2、开始菜单=》Windows

Windows Server 2016-Powershell加域并指定OU (二)

南笙酒味 提交于 2021-02-14 23:58:55
上章节提到通过netdom join加域并指定对应OU,本章再补充一例现成powershell加域并指定对应OU的脚本,便于大家工作中使用。 $PlainPassword = P@ssw0rd $UserName="Administrator" $DomainName="azureyun.com" $DomainUserName="$UserName@"+"$DomainName" $SecurePassword = $PlainPassword | ConvertTo-SecureString -AsPlainText -Force $DomainCredentials = New-Object System.Management.Automation.PSCredential -ArgumentList $DomainUserName,$SecurePassword Add-Computer –NewName 新计算机名 -DomainName azureyun.com -OUPath "OU=syncall,DC=azureyun,DC=com" -Confirm:$false -Credential $Credential –Restart 注解:红色字体,新计算机名位置属于您要更改的新计算机名即可。 欢迎关注微信公众号:小温研习社 来源: oschina 链接: