News for hackers. Stuff that matters.
Re:The increased use of PowerShell in attacks [pdf] by c0wb0yc0d3r on Friday May 19, 2017 @04:17PM (#14378998)
I agree that powershell can be hard to debug but I would not say that C# is exactly easier to use. Some cases sure, but when it comes to machine management especially, powershell destroys C#. Another example of powershell being superior to C# would be ist ability to interact with RESTful APIs and parsing JSON (see Invoke-RestMethod ConvertFrom-Json, and ConvertTo-Json). Not saying that it can't be done in C#, but definitely far easier in powershell.
Re:The increased use of PowerShell in attacks [pdf] by braveo on Friday May 19, 2017 @05:32PM (#14379511)
Powershell works well as a shell, but fails specacularly as a programming language.

The whole "I can run this script on 100 different machines at once super easy" is fine, but lets see you try to write some rigorous code in PS and the come back and tell me how it's easier than C#.

They both have their place.

Re:The increased use of PowerShell in attacks [pdf] by Arnavion on Friday May 19, 2017 @06:49PM (#14379911)
I once took over a certain repository that builds a dozen or so disparate external libraries with dependencies between themselves. The original developer of the repository did it by manually remembering which library had which dependencies and running .bat scripts to build them in order.

When I took over it, I wrote a PS script to automate the whole build. The script contains a description of each library's dependencies, so it knows what order to build all the libraries in. Each library is built in its own "job" using Start-Job, so the builds are also maximally parallelized; the script is essentially a loop of two functions: `for each library -> if library's dependencies have all been built -> start parallel job to build library` and `for each job -> if the job has finished -> mark the library as built`.

I would not write it in C#. Most of the build steps for each library involve running other processes, so using a shell DSL rather than multiple Process.Start()+Process.WaitForExit() is convenient. Even things like copying files is more convenient using Copy-Item than C#, especially since the PS versions support globs.

I would hope a build tool counts as both rigorous code as well as justifies PS as a programming language.

Aside: The repository was forked by some other people who did not like / could not read PS, so they rewrote it in Python. The Python version is several times larger than the PS version, though to be fair to it it's also more generic and has more features. A lot of that verbosity though does come from the more verbose code for spawning processes from Python compared to PS.

Re:The increased use of PowerShell in attacks [pdf] by braveo on Saturday May 20, 2017 @10:24AM (#14382498)
Sure, but I bet your PS code isn't rigorous or bullet proof.

and I should mention, I feel like that's a solved problem. I don't know the specifics of the project, but it's hard for me to buy that you needed to write dependency checker in PS.

Re:The increased use of PowerShell in attacks [pdf] by arghimonmobile2 on Saturday May 20, 2017 @12:06AM (#14380976)
Soooo... you reimplemented GNU Make?
Re:The increased use of PowerShell in attacks [pdf] by JadeNB on Saturday May 20, 2017 @08:17AM (#14382055)
> Soooo... you reimplemented GNU Make?

Well, it puts Arnavion in good company: https://en.wikipedia.org/wiki/List_of_build_automation_softw... .

Re:The increased use of PowerShell in attacks [pdf] by Arnavion on Saturday May 20, 2017 @12:40AM (#14381069)
Pretty much, but the build steps are more complicated than what make supports on its own, so even a makefile would have had to be augmented by shell scripts anyway.