Skip to content

Latest commit

 

History

History
143 lines (142 loc) · 3.28 KB

2018-03-08.md

File metadata and controls

143 lines (142 loc) · 3.28 KB

¿Qué hacen los siguientes scripts?

PowerShell

Start-Process -FilePath "powershell" -Verb runAs
Get-WmiObject Win32_UserAccount
Get-WmiObject -Query "SELECT * FROM Win32_Account" | Select-Object Name | Select-String "Administrador"
Get-LocalUser
#Ejecutar PowerShell como administrador
$pass=ConvertTo-SecureString "11234aaa@@€dsf" -asplaintext -force
New-LocalUser usuario -Password $pass
#Es necesario abrir PowerShell como administrador
Remove-LocalUser usuario
Add-LocalGroupMember -Member usuario -Group administradores
Remove-LocalGroupMember -Member usuario -Group grupo
Get-WmiObject -Query "SELECT * FROM Win32_Account" | Select-Object SID
$kb=Read-Host NúmeroActualización
((Get-HotFix).hotfixid | Select-String $kb)
(Get-HotFix).Description | Group-Object
((Get-WmiObject -Class Win32_Product).name).count
if(((Get-WmiObject -Class Win32_Product).name) | Select-String "Gimp"){"Instalado"}
Get-Process -Name (Read-Host 'N') -Module
(Get-WmiObject win32_process) | Select-Object ProcessId,Description,ParentProcessId
Get-Process | Select-Object ProcessName | Select-String "svchost"
Get-WmiObject -Class Win32_Account | Select-String ""
((Get-WmiObject -Class Win32_Product).name).count
$kb=Read-Host NúmeroActualización;((Get-HotFix).hotfixid | Select-String $kb)
Get-Process -Name (Read-Host 'N') -Module
Register-ScheduledTask Task01 -Action (New-ScheduledTaskAction -Execute "notepad") -Principal (New-ScheduledTaskPrincipal -GroupId "BUILTIN\administradores" -RunLevel Highest) -Settings (New-ScheduledTaskSettingsSet -RestartCount 5 -RestartInterval 60)
Get-ChildItem | where LastWriteTime -gt (get-date).AddDays(-10)
(Get-Process).Where{$_.Name -like "chrome"}
"121" | Out-File pid.txt
Stop-Process (gc pid.txt)
"notepad" | Out-File name.txt
Stop-Process -name (gc name.txt)
"121,122" | Out-File pids.txt
Stop-Process (gc pids.txt).Split(",")
"notepad,chrome" | Out-File names.txt
Stop-Process -name (gc name.txt).Split(",")

Linux

#!/bin/bash
# Script to add a user to Linux system
if [ $(id -u) -eq 0 ]; then
	read -p "Enter username : " username
	read -s -p "Enter password : " password
	egrep "^$username" /etc/passwd >/dev/null
	if [ $? -eq 0 ]; then
		echo "$username exists!"
		exit 1
	else
		pass=$(perl -e 'print crypt($ARGV[0], "password")' $password)
		useradd -m -p $pass $username
		[ $? -eq 0 ] && echo "User has been added to system!" || echo "Failed to add a user!"
	fi
else
	echo "Only root may add a user to the system"
	exit 2
fi
`echo "ohw" | rev`
crontab -e
*/5 * * * *  /home/kali/pidnano.sh > log
cut -d: -f1 /etc/passwd
sudo adduser new_username
sudo useradd new_username
sudo passwd username
wc exampl
cat exampl | wc
wc -l exampl
wc -w exampl
wc -c exampl
grep hola exampl
cut -d: -f 1,3 /etc/passwd