Показват се публикациите с етикет windows. Показване на всички публикации
Показват се публикациите с етикет windows. Показване на всички публикации

понеделник, януари 23, 2023

Windows CLI get file from Internet (like wget or curl)

CMD: (bitsadmin is depricated)

 bitsadmin /transfer <DownloadJobName> /download /priority normal http://example.com/example.txt C:\example.txt

BITSAdmin tool does not provide an option to ignore certificate errors

PS: 

Invoke-WebRequest -Uri http://example.com/example.txt -OutFile C:\example.txt

Start-BitsTransfer -Source http://example.com/example.txt -Destination C:\example.txt

Invoke-WebRequest -Uri https://example.com/example.txt -OutFile C:\example.txt -SkipCertificateCheck

(to skip certificate errors)

четвъртък, май 20, 2021

Access files between WSL instances

 Preamble:

C:\Users\Ivan Popov>ver && wsl --list
Microsoft Windows [Version 10.0.19041.985]
Windows Subsystem for Linux Distributions:
Debian (Default)
kali-linux

ToDo: access files in $HOME on Debian wsl instance from kali-linux wsl instance 

Dunno how (and don't care actually) rootfs is mounted in Windows, but files are located here: 

C:\Users\%USERNAME%\AppData\Local\Packages\TheDebianProject.DebianGNULinux_76v4gfsz19hv4\LocalState\rootfs\home

(TheDebianProject.DebianGNULinux depends of installed distro)

In WSL current disk partitions are already mounted under /mnt/Disk_Letter

To access my debian_home from kali I executed: 

echo "sudo mount -B /mnt/c/Users/My\ Current\ WinUserName/AppData/Local/Packages/TheDebianProject.DebianGNULinux_76v4gfsz19hv4/LocalState/rootfs/ /mnt/deb/
" >> ~/.bashrc

[fstab entry should be in format /old_dir /new_dir none bind but for some reason didn't work]

The result:

$ls /mnt/deb/
total 620
drwxr-xr-x 1 root root   4096 May  3 23:31 .
drwxr-xr-x 1 root root   4096 May 20 15:59 ..
drwxr-xr-x 1 root root   4096 May 17 19:04 bin
drwxr-xr-x 1 root root   4096 Mar 20 00:44 boot
drwxr-xr-x 1 root root   4096 Apr  6 14:47 dev
drwxr-xr-x 1 root root   4096 May 17 19:04 etc
drwxr-xr-x 1 root root   4096 May  3 23:33 home
-rwxr-xr-x 1 root root 632048 May  5 00:48 init
drwxr-xr-x 1 root root   4096 Apr  6 14:48 lib
drwxr-xr-x 1 root root   4096 Apr  6 14:47 lib64
drwxr-xr-x 1 root root   4096 Apr  6 14:47 media
drwxr-xr-x 1 root root   4096 May  5 22:31 mnt
drwxr-xr-x 1 root root   4096 Apr  6 14:47 opt
drwxr-xr-x 1 root root   4096 Mar 20 00:44 proc
drwx------ 1 root root   4096 May  3 23:35 root
drwxr-xr-x 1 root root   4096 Apr  6 14:47 run
drwxr-xr-x 1 root root   4096 May  3 23:31 sbin
drwxr-xr-x 1 root root   4096 Apr  6 14:47 srv
drwxr-xr-x 1 root root   4096 Mar 20 00:44 sys
drwxrwxrwt 1 root root   4096 May 20 14:49 tmp
drwxr-xr-x 1 root root   4096 Apr  6 14:47 usr
drwxr-xr-x 1 root root   4096 Apr  6 14:47 var


петък, декември 18, 2020

Hyper-V nested virtualization (for EVE-NG примерно)

 Run PowerShell as Administrator

Set-VMProcessor -VMName "VirtualMachineName" -ExposeVirtualizationExtensions $True
VirtualMachineName - the  name of previously created VM on which we want to start nested virtualization 

събота, октомври 05, 2013

понеделник, май 14, 2012

вторник, май 01, 2012

Windows files copy


RoboCopy (part of Resource Kit 2003) - console only, multithread mode with /MT:nn (1< n >128) - very good tool - mirror option, logging, retry N and so one. Full list of avialable options HERE
RichCopy - simple but with GUI. Nothing special, just doing his job well
vXCopy - simple and light. Max threads = 15
native utility xcopy - /c (continue if error) /z (restartable mode via Network), ACL/NFTS permissions aware- sux coz only 1 thread. Good for scripting
copy - native for cmd shell. Missing (or tricky)  ability to copy entire subdirectories

вторник, май 24, 2011

Robocopy

Задача: да се мигрират redirected user folders(Desktop & My Documents) на друг сървър и storage.
Варианти: rsync for Windows, но това искаше иснталации и на двете машини (source & destination) и native за Windows - robocopy.
Сериозните опции са /mir и /copyall
Същественната разлика м/у /mir и /copyall, е че /mir изтрива съдръжанието на destination folder-a и го замества със съдържанието на source folder-a, докато при /copyall ако има промени в source folder-a при стартирането ще се отразят в destination folder-a без да се загубят промените които м/у временно са възникнали в destination folder-a
Примерно:
Robo_source : file1, dir1
Robo_dest: file2, dir2
след robocopy \\server1\Robo_source \\server2\Robo_dest /mir /e /tee съдържанието на Robo_dest == file1, dir1;
докато след robocopy \\server1\Robo_source \\server2\Robo_dest /copyall /e /tee съдържанието на Robo_dest == file2, dir2, file1, dir1;
Useful switches:
/z - restartable mode
/save:job.file - run and save command + swtiches in job.file.rcj (/save:job.file.rcj трабва да е най-накрая в списъка с допълнителните ключове - т.е. записва се всичко до /save:xxx, но не и след него). Създава се файл: job.file.RCJ
/save:job.file /quit - just save command + switches (do not run anything)
/job:job.file - read from job.file.rcj and run what you read
/mon:N - monitor for N changes in Source_dir
/mot:N - monitor in N min for changes in Source_dir
Examples:
1. full mirror
robocopy \\server1\Robo_source \\server2\Robo_dest /mir /e /tee
2. Update Robo_dest with changes in Robo_source (e.g. differential)
\\server1\Robo_source \\server2\Robo_dest /copyall /e /tee
3. Just monitor for 3 changes every 3 minutes
\\server1\Robo_source \\server2\Robo_dest /mon:3 /mot:3 (?!)- на теория трябва само да следи за промени ама май направо си ъпдейтва Robo_dest с промените в Robo_source

П.С. версиите до W2k8 не "реагират" при промяна на атрибутите за NTFS permissions, но във Vista и Windows 2008 (R2) вече има допълнителен ключ - /secfix
MS графичен фронт-енд
Robocopy записва в EventViewer-a какво се случва, но по-юзъбъл за мен е mail notification

четвъртък, ноември 11, 2010

What is my OS

Каква е версията на OS на машината на която съм се логнал ?
Linux:
uname -a -- kernel version, 32/64 bits
lsb_release -a
cat /etc/*issue
cat /etc/*-release
cat /etc/*_version
cat /proc/version
*BSD:
uname -a
Solaris
showrev -a
HP-UX:
uname -r -> това дава release identifier и после по този release identifier тук примерно
IOS/XOS (Extreme Networks) :
show ver
NT based Windows (7/Vista/2003/XP/2000/NT4):
Run/cmd -> msinfo32
Run/cmd -> winver
Run/cmd systeminfo | find /i "System Type:"

неделя, февруари 22, 2009