You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
312 lines
15 KiB
312 lines
15 KiB
-Qt for wayland requires qt5-wayland package and "export QT_QPA_PLATFORM=wayland"
|
|
|
|
-You still have tor and "arm" to monitor it
|
|
|
|
-Docker is pretty cool you should use it, https://www.kali.org/news/official-kali-linux-docker-images/
|
|
also works with wifite2, it basically is a shell-oriented low-weight high-performance virtual machine
|
|
wich can run prebuilt docker images or your personal docker images. Docs: https://docs.docker.com/
|
|
|
|
# ARCH SECTION
|
|
|
|
-Pacman commands:
|
|
"pacman -Syy" update repositories
|
|
"pacman -Su" update packages
|
|
"pacman -Qdtq" list unused/orphan packages
|
|
"pacman -R" remove a package
|
|
"pacman -S" install a package
|
|
"pacman -R $(pacman -Qdtq)" remove unused packages
|
|
"pacman -Rns" remove packages and its dependencies (recursively)
|
|
"pacman -Ql" list all package's files and locations
|
|
"pacman -Qqe" list all installed packages
|
|
"pacman -Qc" view package changelog
|
|
If you panic just do "sudo pacman -Syy" and then "sudo pacman -Su"
|
|
"rm -rf /var/lib/pacman/db.lck" remove pacman's transaction lock file
|
|
(to solve "could not unlock database" error)
|
|
To manage and download packages from the AUR use:
|
|
pikaur
|
|
yaourt (unmantained)
|
|
These are all wrappers which means they extend some functionalities of pacman to use
|
|
AUR, for example updating and installing packages (-Syu and -S)
|
|
NOTE: pacman wrappers don't need to be run as root since it's dangerous to
|
|
run PKGBUILD as such.
|
|
|
|
# SYSADMIN SECTION
|
|
|
|
-"acpi" is kinda important in laptops "acpi -i" for info, also "thinkpad_acpi" should be noted
|
|
|
|
-Basic commands:
|
|
GREP:
|
|
G-REP or "grep" can be used to filter command results:
|
|
"ps ax | grep whatyouwant" and it will output the line containing "whatyouwant"
|
|
example "dmesg | grep whatyouwant"
|
|
NOTE: "|" is used to pipe the output in another program
|
|
PS:
|
|
Ps is a UNIX tool used to get information about the current status of the system
|
|
The most basic and or useful usage is to view all the running processes and the corresponding
|
|
UUIDs (like if you want to kill process and you need its UUID), that is done by appending "ax"
|
|
to ps: "ps ax"
|
|
KILL:
|
|
It kill the specified process given its UUID, syntax "kill <UUID>"
|
|
"|" and ">":
|
|
These are both "pipe" functions, they can pipe the output of a script or program into
|
|
something (via std i/o), but they are used differently in the sense that "|" is specifically
|
|
used to pipe the output into another program EX: "ps ax | grep gnome-shell", this outputs the UUIDs
|
|
of all the gnome-shell instances since the output of "ps ax" is piped into GREP which in turn
|
|
returns just the results of the query.
|
|
On the other hand ">" is used to pipe the output into a file EX: "ls -la > ls.txt", this puts
|
|
the output of ls into ls.txt which we can then read.
|
|
"whoami" and "groups":
|
|
they respectively output the current user and groups
|
|
NOTE: one alternative to "whoami" is "echo $USER" which can be used in scripts
|
|
FIND:
|
|
Sources:
|
|
https://www.cyberciti.biz/faq/how-do-i-find-all-the-files-owned-by-a-particular-user-or-group/
|
|
refer to man for all the available options
|
|
Basic syntax:
|
|
"find <dir> [OPTIONS]"
|
|
OPTIONS:
|
|
"-user <user>" find files owned by a particular user
|
|
"-group <group>" find files owned by a particular group
|
|
"-ls" list results in "ls" format:
|
|
"-name <filename>" find a specific file or pattern (*.txt)
|
|
|
|
-Groups:
|
|
Adding users to groups:
|
|
"usermod -a -G grup user"
|
|
reboot
|
|
Listing all groups:
|
|
"cut -d: -f1 /etc/group | sort"
|
|
|
|
-Linux afterinstall (how to get thing working):
|
|
Bluetooth usage:
|
|
Refers to:
|
|
https://wiki.archlinux.org/index.php/Bluetooth_headset
|
|
https://wiki.archlinux.org/index.php/bluetooth
|
|
Start the "bluetooth.service" service then refer to:
|
|
Generating locales (languages and language support):
|
|
Add locales uncommenting them in /etc/locale.gen
|
|
Run "locale-gen"
|
|
Reboot
|
|
NOTE: if installing locales with a specific character set (russian, chinese, japanese)
|
|
it is needed to also install the specific fonts, refer to:
|
|
"https://wiki.archlinux.org/index.php/Localization" to find the specific font packages
|
|
and install them using pacman
|
|
Getting the graphics drivers:
|
|
For Intel graphics cards:
|
|
Refers to: https://wiki.archlinux.org/index.php/intel_graphics
|
|
mesa
|
|
lib32-mesa
|
|
vulkan-intel
|
|
For nvidia graphics cards:
|
|
Please refer to: https://wiki.archlinux.org/index.php/NVIDIA#Installation
|
|
For amd graphics cards:
|
|
mesa
|
|
lib32-mesa
|
|
xf86-video-ati: for Xorg hardware acceleration support
|
|
mesa-vdpau and lib32-mesa-vdpau: for accelerated video decoding
|
|
|
|
-Listing installed packages:
|
|
With apt/apt-get:
|
|
"apt list --installed"
|
|
With pacman:
|
|
"pacman -Qqe"
|
|
|
|
-"https://wiki.archlinux.org/index.php/systemd" just helpful
|
|
|
|
-To run .jar files in cli you must use "java -jar"
|
|
|
|
-To list all partitions "sudo fdisk -l"
|
|
|
|
-To check a disk's health you need "smartmontools", first check system compatibility with "sudo smartctl -c /dev/sdX"
|
|
then either do a short test "sudo smartctl -t short /dev/sdX" or a long test "sudo smartctl -t long /dev/sdX"
|
|
lastly do "sudo smartctl -H /dev/sdX" to get the results
|
|
|
|
-Recompiling compilers for zerynth:
|
|
If facing compiling errors in zerynth, manually recompile the compiler for the board in ""~/.zerynth2/sys"
|
|
for example replacing the xtensa-lx106 compiler (esp8266) goes:
|
|
1-Move the old compiler folder somewhere safe (~/.zerynth2/sys/xtensa-lx106)
|
|
2-Clone and compile (as standalone) new compiler in a temporary folder, guide here -> "http://domoticx.com/sdk-esp8266-xtensa-architecture-toolchain/"
|
|
3-Move the newly created compiler folder (xtensa-lx106-elf) in ~/.zerynth2/sys and rename it as the original one (xtensa-lx106/)
|
|
4-Copy the old package.json in the new compiler folder
|
|
Better yet is to wait for an official fix and report the bug on the troubleshooting section
|
|
Also the same thing has to be done with the xtensa-lx6 compiler (esp32)
|
|
"https://dl.espressif.com/doc/esp-idf/latest/get-started/linux-setup.html"
|
|
|
|
-Various permission errors:
|
|
Arduino permissions:
|
|
Source: https://www.howtogeek.com/50787/add-a-user-to-a-group-or-second-group-on-linux/
|
|
"ls -la /dev/tty*" and see which group TTYs are in, then add yourself to that group:
|
|
"usermod -a -G examplegroup exampleusername" or just use "$USER" to add current user, then reboot.
|
|
Wireshark permissions:
|
|
"usermod -a -G wireshark $USER"
|
|
|
|
-Theming gnome:
|
|
download the theme packages at "https://www.gnome-look.org/" and unzip them
|
|
then depending if it is an icon theme or an normal theme place them in
|
|
"/usr/share/icons" or "/usr/share/themes" accordingly
|
|
|
|
-Adding executables and shortcuts:
|
|
Refers to:
|
|
https://askubuntu.com/questions/322772/how-do-i-add-an-executable-to-my-search-path
|
|
https://unix.stackexchange.com/questions/3809/how-can-i-make-a-program-executable-from-everywhere
|
|
You have to add them to your $PATH, example: "export PATH="$PATH:$HOME/esp/xtensa-esp32-elf/bin"
|
|
Quote "If you just type export PATH=$PATH:</path/to/file> at the command line it will only last for the length of the session.
|
|
If you want to change it permanently add export PATH=$PATH:</path/to/file> to your ~/.bashrc file (just at the end is fine)."
|
|
|
|
-Use "clamav" as antivirus: "https://wiki.archlinux.org/index.php/ClamAV", to update use "freshclam" as sudo
|
|
and to scan "clamscan --recursive --infected /path/to/something"
|
|
|
|
-Some git stuff:
|
|
Creating a repo and pushing the first commit: "https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/"
|
|
basically it's a matter of defining the remote (origin) repo "git remote add origin <repo URL>"
|
|
committing the changes in local repo "git commit -m "message" "
|
|
pushing before first pull "git pull origin master --allow-unrelated-histories" the last part is just to merge the repos (if needed)
|
|
and finally pushing the changes "git push origin master", or in atom just publish
|
|
Using 2 factor auth. in command line and atom: "https://help.github.com/articles/creating-a-personal-access-token-for-the-command-line/"
|
|
basically you have to use a access token instead of the password, these are unique and you can only
|
|
see them once, so be careful with them!
|
|
|
|
-Powertop usage:
|
|
Arch page: https://wiki.archlinux.org/index.php/powertop
|
|
To start powertop use "sudo powertop"
|
|
For the first calibration use "sudo powertop --calibrate", NOTE: it takes a few minutes and during
|
|
that time the screen may go (it does) black for a few minutes too, just let it run.
|
|
To set everything to "good" do "sudo powertop --auto-tune",
|
|
to make the auto-tune start at boot refer to the Arch wiki or "how to create a sysemd service"
|
|
NOTE: in order to apply changes and stuff you have to leave it running for some time to let it
|
|
take its measures and stuff
|
|
|
|
-Power management:
|
|
Arch page: https://wiki.archlinux.org/index.php/Power_management#Power_management_with_systemd
|
|
To change the actions to take when power button or lid switch events occur:
|
|
modify the conf. file at /etc/systemd/logind.conf or /etc/systemd/logind.conf.d/*.conf
|
|
|
|
-Adding executables not located in /bin/ (downloaded from internet):
|
|
Refers to:
|
|
https://askubuntu.com/questions/322772/how-do-i-add-an-executable-to-my-search-path
|
|
https://unix.stackexchange.com/questions/3809/how-can-i-make-a-program-executable-from-everywhere
|
|
Adding them momentarily:
|
|
Add them to your $PATH, example: "export PATH="$PATH:$HOME/esp/xtensa-esp32-elf/bin"
|
|
Adding them at the start of the session:
|
|
Using bashrc:
|
|
Add export PATH=$PATH:</path/to/file> (the bin/ folder) to your ~/.bashrc file (just at the end is fine)
|
|
Using cron:
|
|
Add export PATH=$PATH:</path/to/file> to your crontab file:
|
|
Open your crontab file using "crontab -e" for current user or "crontab -e -u username" fo others
|
|
At the end of the file add "@reboot export PATH=$PATH:</path/to/file>"
|
|
NOTE: probably it is best do to add the command in the "su" cron file
|
|
|
|
-Checking system errors:
|
|
Refers to:
|
|
https://wiki.archlinux.org/index.php/Systemd#Journal
|
|
https://www.digitalocean.com/community/tutorials/how-to-use-journalctl-to-view-and-manipulate-systemd-logs
|
|
If your distro users systemctl the easiest way to check errors is to look up the recent
|
|
events in the system logs to do that type "journalctl"
|
|
|
|
-Windows:
|
|
Adding programs to PATH:
|
|
Source: https://www.howtogeek.com/118594/how-to-edit-your-system-path-for-easy-command-line-access/
|
|
Open: Control panel -> system -> advanced system settings -> environment variables
|
|
On windows 7 or 8:
|
|
Set the variable name to "Path"
|
|
Add the path to the program preceded by ";" ex. "...;C:\path\to\something"
|
|
On windows 10:
|
|
Click on "New"
|
|
Enter the path to the program
|
|
Retrieving the windows product key:
|
|
Open a console with admin privileges
|
|
Type "wmic path softwarelicensingservice get OA3xOriginalProductKey"
|
|
|
|
-Creating a systemd (systemctl) service (aka how to make a program start at boot):
|
|
Guides and references:
|
|
https://askubuntu.com/questions/112705/how-do-i-make-powertop-changes-permanent
|
|
https://wiki.archlinux.org/index.php/powertop
|
|
https://askubuntu.com/questions/919054/how-do-i-run-a-single-command-at-startup-using-systemd
|
|
Create a file under /etc/systemd/system/ and call it <whatever>.service
|
|
Then follow the formatting {
|
|
[Unit]
|
|
Description=PowerTOP auto tune
|
|
|
|
[Service]
|
|
Type=idle # Not necessary
|
|
Environment="TERM=dumb" # Not necessary
|
|
ExecStart="PATHTOEXECUTABLE --OPTIONS"
|
|
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
}
|
|
And then enable it using "systemctl whatever.service enable"
|
|
|
|
# NETWORK SECTION
|
|
|
|
-Gathering information on network cards ie IP, MAC, status, etc.
|
|
With ifconfig, just type "ifconfig" and it will give:
|
|
ether: the MAC address
|
|
inet: the network ip address
|
|
netmatsk: the netmask duh
|
|
inet6: the network ipv6
|
|
With iwconfig (specifically for wireless cards), just type "iwconfig" and it will give:
|
|
Mode: monitor or managed
|
|
ESSID: the ESSID (name) of the connected network
|
|
Frequency
|
|
Access Point: the MAC address of the AP
|
|
Signal level: the power/quality of the signal
|
|
Among other informations
|
|
Sites for public IP discovery and information gathering:
|
|
https://www.iplocation.net/
|
|
http://www.whatsmyip.org/
|
|
|
|
-Changing the MAC address:
|
|
Using macchanger:
|
|
The general usage is "macchanger [OPTIONS] interface", the most common options being
|
|
-A for a random MAC,
|
|
-r to reset to the original one,
|
|
-a to change it to a random MAC of some type (same vendor),
|
|
-b to set the "locally administered" bit set to false or
|
|
-m XX:XX:XX:XX:XX:XX to manually set the MAC address.
|
|
Using ifconfig:
|
|
First disable the interface using "ifconfig <interface> down"
|
|
Then change the MAC address using "ifconfig <interface> hw ether 00:XX:XX:XX:XX:XX"
|
|
it has to begin with 00:*
|
|
Then finally re-enable the interface with "ifconfig <interface> up"
|
|
To prevent the MAC address from reverting to its original state you can configure the network manager
|
|
to not scan for other networks using a random MAC address (that is done for security by many OSs and
|
|
also by phones), to achieve this you have to change the conf. file for your network manager:
|
|
For GNOME (kali) add {
|
|
[device]
|
|
wifi.scan-rand-mac-address=preserve
|
|
|
|
[connection]
|
|
ethernet.cloned-mac-address=preserve
|
|
wifi.cloned-mac-address=preserve
|
|
}
|
|
to /etc/NetworkManager/NetworkManager.conf
|
|
|
|
-Changing interfaces to monitor mode:
|
|
Not mandatory but best use is to first use "airmon-ng check kill", this kills all processes
|
|
that could interfere with the process and later with the attacks
|
|
Using airmon-ng:
|
|
Simply use "airmon-ng start <interface>" to put it in monitor mode
|
|
And "airmon-ng stop <interface>" to revert it to managed
|
|
NOTE: when using airmon-ng it will change the interface name by adding *mon to its name
|
|
for example wlan0 becomes wlan0mon
|
|
Using iwconfig (useful since first method is not always reliable):
|
|
Disable interface using "ifconfig <interface> down" or "ifdown <interface>"
|
|
Change to minitor mode with "iwconfig <interface> mode monitor"
|
|
Re-enable interface with "ifconfig <interface> up" or "ifup <interface>"
|
|
To revert it back to managed disable the interface then do "iwconfig <interface> mode managed"
|
|
then re-enable the interface
|
|
|
|
-Restarting network interfaces:
|
|
Without ssh:
|
|
Disable and re-enable the interface with "ifdown <interface>" and then "ifup <interface>"
|
|
or "ifconfig <interface> down" and then "ifconfig <interface> up"
|
|
On ssh:
|
|
Non systemd "/etc/init.d/networking restart"
|
|
Systemd (Arch) "systemctl restart NetworkManager"
|
|
|
|
-Enabling IP forwarding:
|
|
Arch page: https://wiki.archlinux.org/index.php/Internet_sharing_(Italiano)
|
|
"echo 1 > /proc/sys/net/ipv4/ip_forward"
|
|
To revert it back:
|
|
"echo 0 > /proc/sys/net/ipv4/ip_forward"
|
|
|