##CUSTOM ALIAS SHELL (~/.bashrc):
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval “$(dircolors -b ~/.dircolors)” || eval “$(dircolors -b)”
alias ls=’ls –color=auto’
alias Ssh=’ssh -o HostKeyAlgorithms=ssh-dss -o KexAlgorithms=diffie-hellman-group14-sha1 ‘
alias ping=’ping -O’
alias Ping=’ping -a -O’
#alias dir=’dir –color=auto’
#alias vdir=’vdir –color=auto’
fi
##VIRTUALBOX REBUILD MODE:
sudo dpkg-reconfigure virtualbox-dkms
——————————————
##SSH CONNECTION MY SHELL:
– SSH Nuovo protocollo:
ssh -l root 192.168.XXX.XXX
– SSH Vecchio protocollo:
Ssh root@192.168.XXX.XXX
——————————————
##MC LOCAL CONNECTION:
MC left pc -> F9 – Shell link.. – root@192.168.XXX.XXX
——————————————
##RASPBERRY CONFIGURATION:
autostart.sh -> remmina -c /home/pi/RDP.remmina
——————————————
##GRUTILITY CRASH
/etc/init.d/apache2 start
——————————————
##ENABLE CONNECT SSH:
passwd root
systemctl stop iptables
——————————————
##MOUNT:
mkdir /mnt/usb
mount -t vfat /dev/sdb1 /mnt/usb
ntfs-3g /dev/sda1 /mnt/windows
——————————————
##CHANGE PSW WINDOWS:
cd Windows/System32/config
chntpw -l SAM (o sam)
chntpwd -u Administrator SAM
2
q
y
——————————————
##CLONE:
Clonazione disco (pv=avanzamento)
dd if=/dev/sda | pv | dd of=/dev/sdb
Clonazione da disco grande a piccolo
– Gparted -> Resize e poi spostare partizione di recupero lasciando spazio vuoto alla fine
– Usare il dd
– gdisk -> w -> y
– riporto disco normale
# backup
dd if=/dev/hdx | gzip > /path/to/image.gz
# restore
gzip -dc /path/to/image.gz | dd of=/dev/hdx
——————————————
Clonazione disco RESCUE
ddrescue -r2 -f /dev/sdc /dev/sdb
-> -r + numero = tentativi retray
-> -f = Force overwrite of outfile. Needed when outfile is not a regular file, but a device or partition.
——————————————
##SAMBA NETWORK SHARE CONNECT
sudo mount -t cifs //192.168.84.11/c$ /mnt/Temp -o uid=1000,gid=1000,rw,user,username=Administrator,domain=gruppo-grigolin.local
——————————————
##CONTROL PRINTERS VIA CMD:
@echo off
REM RUNDLL32 PRINTUI.DLL,PrintUIEntry /y /n “HP Officejet Pro 8500”
@echo Add a network printer from windows command line
rem cscript C:\windows\system32\Printing_Admin_Scripts\it-IT\prnmngr.vbs -p “printername” -s “servername”
@echo Get the list of printers added to the system from Windows command line(CMD).
rem cscript C:\windows\system32\Printing_Admin_Scripts\it-IT\prnmngr.vbs -l
@echo Get the default printer details from command line.
rem cscript C:\windows\system32\Printing_Admin_Scripts\it-IT\prnmngr.vbs -g
@echo Set default printer from windows command line.
rem cscript C:\windows\system32\Printing_Admin_Scripts\it-IT\prnmngr.vbs -t -p “\\Servername\printername”
pause
—————————————–
##DISABLE/ENABLE NETMASK:
netsh interface set interface “Ethernet 2” disable
netsh interface show interface
—————————————–
##CHANGE TYPE CONNECTION:
Get-NetConnectionProfile
Set-NetConnectionProfile -InterfaceIndex xx -NetworkCategory Private
—————————————–
##PREVIEW KEYS:
Word Preview : HKCR\CLSID\{84F66100-FF7C-4fb4-B0C0-02CD7FB668FE}
PowerPoint Preview : HKCR\CLSID\{65235197-874B-4A07-BDC5-E65EA825B718}
Excel Preview : HKCR\CLSID\{00020827-0000-0000-C000-000000000046}
——————————————-
##FUNCTION MAIUSCOLO:
Sub Maiuscolo()
For Each Cell In Selection
If Not Cell.HasFormula Then
Cell.Value = UCase(Cell.Value)
End If
Next Cell
End Sub
——————————————-
#Per proxy ovveride (c’è la sezione ProxyOvveride dove mettere gli indirizzi separati da 😉
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Internet Settings
——————————————-
Solo cartelle vuote:
Get-ChildItem ‘Y:\’ -Recurse -Directory | Where-Object {[System.IO.Directory]::GetFileSystemEntries($_.FullName).Count -eq 0} | ForEach-Object {$_.FullName}
——————————————-
Framework Offline .Net3
Dism.exe /online /enable-feature /featurename:NetFX3 /All /Source:D:\sources\sxs /LimitAccess
——————————————-
Framework Offline .Net2
DISM /Online /Enable-Feature /FeatureName:NetFx3 /All
——————————————-
Powershell Fix App:
Get-AppXPackage -allusers | Foreach {Add-AppxPackage -DisableDevelopmentMode -Register “$($_.InstallLocation)\AppXManifest.xml”}
——————————————-
TPM 2.0 Not trusted:
from C:\users\$dir\AppData\Local\Packages\Microsoft.AAD.BrokerPlugin_cw5n1h2txyewy
to C:\users\$dir\AppData\Local\Packages\Microsoft.AAD.BrokerPlugin_cw5n1h2txyewy.old
——————————————-
##CHECK NAME FILE/FOLDER LENGHT:
dir /s /b | sort /r /+261 > out.txt
——————————————-
#GET FILE FROM HTML
wget -r -np -nH –cut-dirs=3 -R index.html http://hostname/aaa/bbb/ccc/ddd/
Explanation:
It will download all files and subfolders in ddd directory
-r : recursively
-np : not going to upper directories, like ccc/…
-nH : not saving files to hostname folder
–cut-dirs=3 : but saving it to ddd by omitting first 3 folders aaa, bbb, ccc
-R index.html : excluding index.html files
——————————————
##Excel Psw Breaker:
Sub PasswordBreaker()
‘Breaks worksheet password protection.
Dim i As Integer, j As Integer, k As Integer
Dim l As Integer, m As Integer, n As Integer
Dim i1 As Integer, i2 As Integer, i3 As Integer
Dim i4 As Integer, i5 As Integer, i6 As Integer
On Error Resume Next
For i = 65 To 66: For j = 65 To 66: For k = 65 To 66
For l = 65 To 66: For m = 65 To 66: For i1 = 65 To 66
For i2 = 65 To 66: For i3 = 65 To 66: For i4 = 65 To 66
For i5 = 65 To 66: For i6 = 65 To 66: For n = 32 To 126
Debug.Print Chr(i) & Chr(j) & Chr(k) _
& Chr(l) & Chr(m) & Chr(i1) _
& Chr(i2) & Chr(i3) & Chr(i4) _
& Chr(i5) & Chr(i6) & Chr(n)
DoEvents
ActiveSheet.Unprotect Chr(i) & Chr(j) & Chr(k) & _
Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & Chr(i3) & _
Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
If ActiveSheet.ProtectContents = False Then
MsgBox “One usable password is ” & Chr(i) & Chr(j) & _
Chr(k) & Chr(l) & Chr(m) & Chr(i1) & Chr(i2) & _
Chr(i3) & Chr(i4) & Chr(i5) & Chr(i6) & Chr(n)
Exit Sub
End If
Next: Next: Next: Next: Next: Next
Next: Next: Next: Next: Next: Next
End Sub