Compare commits
1 Commits
main
..
6a2a10df79
| Author | SHA1 | Date | |
|---|---|---|---|
| 6a2a10df79 |
@@ -1,13 +0,0 @@
|
|||||||
{
|
|
||||||
"version": 1,
|
|
||||||
"isRoot": true,
|
|
||||||
"tools": {
|
|
||||||
"haveibeenpwned-downloader": {
|
|
||||||
"version": "0.5.25",
|
|
||||||
"commands": [
|
|
||||||
"haveibeenpwned-downloader"
|
|
||||||
],
|
|
||||||
"rollForward": false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
* text eol=lf
|
|
||||||
*.txt text eol=lf
|
|
||||||
*.sh text eol=lf
|
|
||||||
*.ini text eol=lf
|
|
||||||
*.yml text eol=lf
|
|
||||||
*.md text eol=lf
|
|
||||||
.env text eol=lf
|
|
||||||
*.ps1 text eol=crlf
|
|
||||||
*.bat text eol=
|
|
||||||
*.pdf binary
|
|
||||||
*.doc binary
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
*/webhook.txt
|
|
||||||
*/tag.txt
|
|
||||||
*.tmp
|
|
||||||
*.csv
|
|
||||||
*.sha256
|
|
||||||
@@ -1,218 +0,0 @@
|
|||||||
---
|
|
||||||
- name: 'Configure Remote Servers'
|
|
||||||
hosts: remoteservers
|
|
||||||
vars_files:
|
|
||||||
- './variables.yml'
|
|
||||||
tasks:
|
|
||||||
# packages
|
|
||||||
- name: 'Updating apt cache'
|
|
||||||
apt:
|
|
||||||
force_apt_get: True
|
|
||||||
update_cache: True
|
|
||||||
- name: 'Upgrading all apt packages'
|
|
||||||
apt:
|
|
||||||
force_apt_get: True
|
|
||||||
upgrade: full
|
|
||||||
become: yes
|
|
||||||
- name: 'Selected packages to install:'
|
|
||||||
debug:
|
|
||||||
msg: "{{ item }}"
|
|
||||||
loop: "{{ list_of_packages }}"
|
|
||||||
- name: "Installing packages"
|
|
||||||
apt:
|
|
||||||
force_apt_get: True
|
|
||||||
name: "{{ list_of_packages }}"
|
|
||||||
state: present
|
|
||||||
- name: 'Remove useless packages from the cache'
|
|
||||||
apt:
|
|
||||||
force_apt_get: True
|
|
||||||
autoclean: yes
|
|
||||||
- name: 'Run the equivalent of apt-get clean'
|
|
||||||
apt:
|
|
||||||
force_apt_get: True
|
|
||||||
clean: yes
|
|
||||||
# add and configure the user
|
|
||||||
- name: "Add the user {{ new_username }}"
|
|
||||||
user:
|
|
||||||
name: "{{ new_username }}"
|
|
||||||
shell: "{{ login_shell }}"
|
|
||||||
# password: "{{ user_password }}"
|
|
||||||
groups: 'sudo,www-data'
|
|
||||||
append: yes
|
|
||||||
- name: "Set authorized key for {{ new_username }}"
|
|
||||||
ansible.posix.authorized_key:
|
|
||||||
user: "{{ new_username }}"
|
|
||||||
key: "{{ ssh_key_auth }}"
|
|
||||||
state: present
|
|
||||||
# zsh
|
|
||||||
- name: 'Setting up zsh'
|
|
||||||
blockinfile:
|
|
||||||
path: "/home/{{ new_username }}/.zshrc"
|
|
||||||
block: |
|
|
||||||
# Set up the prompt
|
|
||||||
autoload -Uz promptinit
|
|
||||||
promptinit
|
|
||||||
prompt adam1
|
|
||||||
setopt histignorealldups sharehistory
|
|
||||||
# Use emacs keybindings even if our EDITOR is set to vi
|
|
||||||
bindkey -e
|
|
||||||
# Keep 1000 lines of history within the shell and save it to ~/.zsh_history:
|
|
||||||
HISTSIZE=1000
|
|
||||||
SAVEHIST=1000
|
|
||||||
HISTFILE=~/.zsh_history
|
|
||||||
# Use modern completion system
|
|
||||||
autoload -Uz compinit
|
|
||||||
compinit
|
|
||||||
zstyle ':completion:*' auto-description 'specify: %d'
|
|
||||||
zstyle ':completion:*' completer _expand _complete _correct _approximate
|
|
||||||
zstyle ':completion:*' format 'Completing %d'
|
|
||||||
zstyle ':completion:*' group-name ''
|
|
||||||
zstyle ':completion:*' menu select=2
|
|
||||||
eval "$(dircolors -b)"
|
|
||||||
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
|
|
||||||
zstyle ':completion:*' list-colors ''
|
|
||||||
zstyle ':completion:*' list-prompt %SAt %p: Hit TAB for more, or the character to insert%s
|
|
||||||
zstyle ':completion:*' matcher-list '' 'm:{a-z}={A-Z}' 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=* l:|=*'
|
|
||||||
zstyle ':completion:*' menu select=long
|
|
||||||
zstyle ':completion:*' select-prompt %SScrolling active: current selection at %p%s
|
|
||||||
zstyle ':completion:*' use-compctl false
|
|
||||||
zstyle ':completion:*' verbose true
|
|
||||||
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#)*=0=01;31'
|
|
||||||
zstyle ':completion:*:kill:*' command 'ps -u $USER -o pid,%cpu,tty,cputime,cmd'
|
|
||||||
eval $(thefuck --alias fuck)
|
|
||||||
PATH=~/.local/bin/:$PATH
|
|
||||||
mode: '0744'
|
|
||||||
owner: "{{ new_username }}"
|
|
||||||
group: "{{ new_username }}"
|
|
||||||
state: present
|
|
||||||
create: True
|
|
||||||
# ufw
|
|
||||||
- name: 'UFW default allow everything outgoing'
|
|
||||||
community.general.ufw:
|
|
||||||
default: allow
|
|
||||||
direction: 'outgoing'
|
|
||||||
- name: 'UFW default deny everything incoming'
|
|
||||||
community.general.ufw:
|
|
||||||
default: deny # reject to throw error instead of drop quietly
|
|
||||||
direction: 'incoming'
|
|
||||||
- name: 'UFW enable logging'
|
|
||||||
community.general.ufw:
|
|
||||||
logging: 'on'
|
|
||||||
- name: 'UFW selected rules:'
|
|
||||||
debug:
|
|
||||||
msg: "{{item.name}}/{{item.proto}}"
|
|
||||||
loop: "{{ open_services }}"
|
|
||||||
- name: 'UFW setting rules'
|
|
||||||
community.general.ufw:
|
|
||||||
rule: allow
|
|
||||||
port: "{{ item.name }}"
|
|
||||||
proto: "{{ item.proto }}"
|
|
||||||
loop: "{{ open_services }}"
|
|
||||||
- name: 'UFW enable'
|
|
||||||
community.general.ufw:
|
|
||||||
state: enabled
|
|
||||||
become: yes
|
|
||||||
# unattended upgrades
|
|
||||||
- name: 'Unattended upgrades initial dpkg reconfigure'
|
|
||||||
command:
|
|
||||||
cmd: 'dpkg-reconfigure -f noninteractive unattended-upgrades'
|
|
||||||
become: yes
|
|
||||||
- name: 'Unattended upgrades configure 20auto-upgrades'
|
|
||||||
blockinfile:
|
|
||||||
dest: '/etc/apt/apt.conf.d/20auto-upgrades'
|
|
||||||
block: |
|
|
||||||
APT::Periodic::Update-Package-Lists "1";
|
|
||||||
APT::Periodic::Unattended-Upgrade "1";
|
|
||||||
mode: '0644'
|
|
||||||
owner: 'root'
|
|
||||||
group: 'root'
|
|
||||||
state: present
|
|
||||||
insertafter: EOF
|
|
||||||
become: yes
|
|
||||||
- name: 'Unattended upgrades configure 50unattended-upgrades'
|
|
||||||
blockinfile:
|
|
||||||
dest: '/etc/apt/apt.conf.d/50unattended-upgrades'
|
|
||||||
block: |
|
|
||||||
Unattended-Upgrade::Automatic-Reboot "true";
|
|
||||||
Unattended-Upgrade::Automatic-Reboot-Time "{{ reboot_time }}";
|
|
||||||
create: True
|
|
||||||
insertafter: EOF
|
|
||||||
mode: '0644'
|
|
||||||
owner: 'root'
|
|
||||||
group: 'root'
|
|
||||||
become: yes
|
|
||||||
- name: 'Unattended upgrades configure daily timer'
|
|
||||||
lineinfile:
|
|
||||||
path: '/lib/systemd/system/apt-daily-upgrade.timer'
|
|
||||||
regexp: '^OnCalendar'
|
|
||||||
line: "OnCalendar=*-*-* {{ install_time }}"
|
|
||||||
state: present
|
|
||||||
become: yes
|
|
||||||
- name: 'Unattended upgrades configure reboot offset'
|
|
||||||
lineinfile:
|
|
||||||
path: '/lib/systemd/system/apt-daily-upgrade.timer'
|
|
||||||
regexp: '^RandomizedDelaySec'
|
|
||||||
line: "RandomizedDelaySec={{ reboot_offset }}"
|
|
||||||
state: present
|
|
||||||
become: yes
|
|
||||||
- name: 'Unattended upgrades last dpkg reconfigure'
|
|
||||||
command:
|
|
||||||
cmd: 'dpkg-reconfigure -f noninteractive unattended-upgrades'
|
|
||||||
become: yes
|
|
||||||
# customscripts
|
|
||||||
- name: 'Customscripts download'
|
|
||||||
git:
|
|
||||||
repo: "{{ custom_scripts_repo }}"
|
|
||||||
dest: '/tmp/cscripts'
|
|
||||||
- name: "Create directory {{ custom_scripts_dir }}"
|
|
||||||
file:
|
|
||||||
path: "{{ custom_scripts_dir }}"
|
|
||||||
state: directory
|
|
||||||
mode: '0755'
|
|
||||||
owner: 'root'
|
|
||||||
group: 'root'
|
|
||||||
become: yes
|
|
||||||
- name: 'Customscripts installing'
|
|
||||||
command:
|
|
||||||
cmd: "cp /tmp/cscripts/customscripts/{{ item }} {{ custom_scripts_dir }}"
|
|
||||||
loop: "{{ custom_scripts }}"
|
|
||||||
become: yes
|
|
||||||
- name: 'Customscripts activating'
|
|
||||||
command:
|
|
||||||
cmd: "chmod 755 {{ custom_scripts_dir }}/{{ item }}"
|
|
||||||
loop: "{{ custom_scripts }}"
|
|
||||||
become: yes
|
|
||||||
# crontabs
|
|
||||||
- name: 'Crontab chkrootkit'
|
|
||||||
cron:
|
|
||||||
name: 'chkrootkit'
|
|
||||||
minute: '0'
|
|
||||||
hour: '8'
|
|
||||||
user: 'root'
|
|
||||||
job: 'chkrootkit -q'
|
|
||||||
state: present
|
|
||||||
become: yes
|
|
||||||
- name: 'Crontab lynis'
|
|
||||||
cron:
|
|
||||||
name: 'lynis'
|
|
||||||
minute: '0'
|
|
||||||
hour: '11'
|
|
||||||
user: 'root'
|
|
||||||
job: 'lynis -q'
|
|
||||||
state: present
|
|
||||||
become: yes
|
|
||||||
# enable services
|
|
||||||
- name: 'enable/restart nginx'
|
|
||||||
service:
|
|
||||||
name: 'nginx'
|
|
||||||
enabled: True
|
|
||||||
state: 'restarted'
|
|
||||||
become: yes
|
|
||||||
- name: 'enable/restart ssh'
|
|
||||||
service:
|
|
||||||
name: 'ssh'
|
|
||||||
enabled: True
|
|
||||||
state: 'restarted'
|
|
||||||
become: yes
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
[remoteservers]
|
|
||||||
someserver ansible_user=root ansible_host=1.1.1.1
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
cd ~ && mkdir ansible-playbook && cd ansible-playbook
|
|
||||||
ansible-playbook ansible-playbook.yml -i inventory.ini
|
|
||||||
ansible remoteservers -m ping
|
|
||||||
|
|
||||||
# errata
|
|
||||||
ssh root@ip
|
|
||||||
passwd princesspi
|
|
||||||
sudo nano /etc/ssh/sshd_config
|
|
||||||
sudo ufw allow 8888
|
|
||||||
sudo bash /usr/share/customscripts/crowdsec.sh
|
|
||||||
@@ -1,230 +0,0 @@
|
|||||||
- name: "Install python3"
|
|
||||||
apt:
|
|
||||||
name: python3
|
|
||||||
state: present
|
|
||||||
- name: "Install python3-pip"
|
|
||||||
apt:
|
|
||||||
name: python3-pip
|
|
||||||
state: present
|
|
||||||
- name: "Install python3-virtualenv"
|
|
||||||
apt:
|
|
||||||
name: python3-virtualenv
|
|
||||||
state: present
|
|
||||||
- name: "Install thefuck"
|
|
||||||
apt:
|
|
||||||
name: thefuck
|
|
||||||
state: present
|
|
||||||
- name: "Install python3-setuptools"
|
|
||||||
apt:
|
|
||||||
name: python3-setuptools
|
|
||||||
state: present
|
|
||||||
- name: "Install nginx"
|
|
||||||
apt:
|
|
||||||
name: nginx
|
|
||||||
state: present
|
|
||||||
- name: "Install wget"
|
|
||||||
apt:
|
|
||||||
name: wget
|
|
||||||
state: present
|
|
||||||
- name: "Install htop"
|
|
||||||
apt:
|
|
||||||
name: htop
|
|
||||||
state: present
|
|
||||||
- name: "Install btop"
|
|
||||||
apt:
|
|
||||||
name: btop
|
|
||||||
state: present
|
|
||||||
- name: "Install lynx"
|
|
||||||
apt:
|
|
||||||
name: lynx
|
|
||||||
state: present
|
|
||||||
- name: "Install neovim"
|
|
||||||
apt:
|
|
||||||
name: neovim
|
|
||||||
state: present
|
|
||||||
- name: "Install docker.io"
|
|
||||||
apt:
|
|
||||||
name: docker.io
|
|
||||||
state: present
|
|
||||||
- name: "Install docker-compose"
|
|
||||||
apt:
|
|
||||||
name: docker-compose
|
|
||||||
state: present
|
|
||||||
- name: "Install screen"
|
|
||||||
apt:
|
|
||||||
name: screen
|
|
||||||
state: present
|
|
||||||
- name: "Install byobu"
|
|
||||||
apt:
|
|
||||||
name: byobu
|
|
||||||
state: present
|
|
||||||
- name: "Install zsh"
|
|
||||||
apt:
|
|
||||||
name: zsh
|
|
||||||
state: present
|
|
||||||
- name: "Install nmap"
|
|
||||||
apt:
|
|
||||||
name: nmap
|
|
||||||
state: present
|
|
||||||
- name: "Install iptraf"
|
|
||||||
apt:
|
|
||||||
name: iptraf
|
|
||||||
state: present
|
|
||||||
- name: "Install iotop"
|
|
||||||
apt:
|
|
||||||
name: iotop
|
|
||||||
state: present
|
|
||||||
- name: "Install zip"
|
|
||||||
apt:
|
|
||||||
name: zip
|
|
||||||
state: present
|
|
||||||
- name: "Install unzip"
|
|
||||||
apt:
|
|
||||||
name: unzip
|
|
||||||
state: present
|
|
||||||
- name: "Install net-tools"
|
|
||||||
apt:
|
|
||||||
name: net-tools
|
|
||||||
state: present
|
|
||||||
- name: "Install git"
|
|
||||||
apt:
|
|
||||||
name: git
|
|
||||||
state: present
|
|
||||||
- name: "Install chkrootkit"
|
|
||||||
apt:
|
|
||||||
name: chkrootkit
|
|
||||||
state: present
|
|
||||||
- name: "Install fail2ban"
|
|
||||||
apt:
|
|
||||||
name: fail2ban
|
|
||||||
state: present
|
|
||||||
- name: "Install lynis"
|
|
||||||
apt:
|
|
||||||
name: lynis
|
|
||||||
state: present
|
|
||||||
|
|
||||||
|
|
||||||
# thefuck
|
|
||||||
- name: "thefuck append to .zshrc"
|
|
||||||
lineinfile:
|
|
||||||
path: "/home/{{ username }}/.zshrc"
|
|
||||||
line: 'eval $(thefuck --alias fuck)'
|
|
||||||
insertafter: EOF
|
|
||||||
mode: '0744'
|
|
||||||
owner: "{{ username }}"
|
|
||||||
group: "{{ username }}"
|
|
||||||
state: present
|
|
||||||
create: True
|
|
||||||
|
|
||||||
# PATH
|
|
||||||
- name: ".zshrc PATH adding ~/.local/bin"
|
|
||||||
lineinfile:
|
|
||||||
path: "/home/{{ username }}/.zshrc"
|
|
||||||
line: 'PATH=~/.local/bin/:$PATH'
|
|
||||||
state: present
|
|
||||||
insertafter: EOF
|
|
||||||
mode: "0744"
|
|
||||||
owner: "{{ username }}"
|
|
||||||
group: "{{ username }}"
|
|
||||||
create: True
|
|
||||||
become: True
|
|
||||||
become_method: su
|
|
||||||
become_user: "{{ username }}"
|
|
||||||
|
|
||||||
|
|
||||||
# ssh
|
|
||||||
- name: "SSH allow {{ username }} only"
|
|
||||||
lineinfile:
|
|
||||||
path: '/etc/ssh/sshd_config'
|
|
||||||
line: "AllowUsers {{ username }}"
|
|
||||||
state: present
|
|
||||||
insertafter: EOF
|
|
||||||
mode: "0644"
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
- name: 'SSH disable password auth'
|
|
||||||
lineinfile:
|
|
||||||
path: '/etc/ssh/sshd_config'
|
|
||||||
regexp: '^PermitRootLogin'
|
|
||||||
line: 'PermitRootLogin no'
|
|
||||||
state: present
|
|
||||||
insertafter: EOF
|
|
||||||
mode: "0644"
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
|
|
||||||
|
|
||||||
- name: "UFW allow ssh"
|
|
||||||
community.general.ufw:
|
|
||||||
rule: allow
|
|
||||||
port: ssh
|
|
||||||
proto: tcp
|
|
||||||
delete: true
|
|
||||||
- name: "UFW allow http"
|
|
||||||
community.general.ufw:
|
|
||||||
rule: allow
|
|
||||||
port: http
|
|
||||||
proto: any
|
|
||||||
delete: true
|
|
||||||
- name: "UFW allow https"
|
|
||||||
community.general.ufw:
|
|
||||||
rule: allow
|
|
||||||
port: https
|
|
||||||
proto: any
|
|
||||||
delete: true
|
|
||||||
|
|
||||||
|
|
||||||
- name: 'Customscripts download'
|
|
||||||
command:
|
|
||||||
cmd: 'git clone https://gitlab.com/princesspi/general-scripts-and-system-ssssssetup.git /tmp/cscripts'
|
|
||||||
become: yes
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
- name: "Create directory {{ custom_scripts_dir }}"
|
|
||||||
file:
|
|
||||||
path: "{{ custom_scripts_dir }}"
|
|
||||||
state: directory
|
|
||||||
mode: '0755'
|
|
||||||
owner: 'root'
|
|
||||||
group: 'root'
|
|
||||||
become: yes
|
|
||||||
- name: 'Customscripts copy add_user_ssh.sh'
|
|
||||||
copy:
|
|
||||||
remote_src: False
|
|
||||||
src: '/tmp/cscripts/customscripts/add_user_ssh.sh'
|
|
||||||
dest: "{{ custom_scripts_dir }}/add_user_ssh.sh"
|
|
||||||
mode: '0744'
|
|
||||||
owner: 'root'
|
|
||||||
group: 'root'
|
|
||||||
become: yes
|
|
||||||
- name: "Customscripts copy crowdsec.sh"
|
|
||||||
copy:
|
|
||||||
remote_src: False
|
|
||||||
src: '/tmp/cscripts/customscripts/crowdsec.sh'
|
|
||||||
dest: "{{ custom_scripts_dir }}/crowdsec.sh"
|
|
||||||
mode: '0744'
|
|
||||||
owner: 'root'
|
|
||||||
group: 'root'
|
|
||||||
become: yes
|
|
||||||
- name: "Customscripts copy fix_permissions.sh"
|
|
||||||
copy:
|
|
||||||
remote_src: False
|
|
||||||
src: '/tmp/cscripts/customscripts/fix_permissions.sh'
|
|
||||||
dest: "{{ custom_scripts_dir }}/fix_permissions.sh"
|
|
||||||
mode: '0744'
|
|
||||||
owner: 'root'
|
|
||||||
group: 'root'
|
|
||||||
become: yes
|
|
||||||
|
|
||||||
# crowdsec
|
|
||||||
- name: 'Crowdsec'
|
|
||||||
command:
|
|
||||||
cmd: "bash {{ custom_scripts_dir }}/crowdsec.sh"
|
|
||||||
become: yes
|
|
||||||
|
|
||||||
- name: 'enable/restart crowdsec'
|
|
||||||
service:
|
|
||||||
name: 'crowdsec'
|
|
||||||
enabled: True
|
|
||||||
state: 'restarted'
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
new_username: 'princesspi'
|
|
||||||
install_time: '02:00'
|
|
||||||
reboot_time: '03:00'
|
|
||||||
reboot_offset: '20m'
|
|
||||||
login_shell: '/usr/bin/zsh' # which zsh
|
|
||||||
custom_scripts_dir: '/usr/share/customscripts'
|
|
||||||
custom_scripts_repo: 'https://github.com/PrincessPi3/general-scripts-and-system-ssssssetup.git'
|
|
||||||
# password is precalculated hash
|
|
||||||
# mkpasswd --method=sha-512
|
|
||||||
# defaultpassword###
|
|
||||||
# user_password: '$6$n3ybB6uVX.BwKiR4$vjENClERci2hmAkn9d9a8EUFAfnUlsH.R6/8EIXx1bu.k.bC7l/aE//s9ONw/PcbSQ2.hRdUgjxFrJ54/NhBm0'
|
|
||||||
ssh_key_auth: 'ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP2D+9oYQlTnu1zeVi2gHfTKE7+DDWiu1EibXNwB9g72'
|
|
||||||
list_of_packages:
|
|
||||||
- 'unattended-upgrades'
|
|
||||||
- 'python3'
|
|
||||||
- 'python3-pip'
|
|
||||||
- 'python3-virtualenv'
|
|
||||||
- 'python3-setuptools'
|
|
||||||
- 'thefuck'
|
|
||||||
- 'nginx'
|
|
||||||
- 'wget'
|
|
||||||
- 'htop'
|
|
||||||
- 'btop'
|
|
||||||
- 'lynx'
|
|
||||||
- 'neovim'
|
|
||||||
- 'docker.io'
|
|
||||||
- 'docker-compose'
|
|
||||||
- 'screen'
|
|
||||||
- 'byobu'
|
|
||||||
- 'zsh'
|
|
||||||
- 'nmap'
|
|
||||||
- 'iptraf'
|
|
||||||
- 'iotop'
|
|
||||||
- 'zip'
|
|
||||||
- 'unzip'
|
|
||||||
- 'net-tools'
|
|
||||||
- 'git'
|
|
||||||
- 'chkrootkit'
|
|
||||||
- 'fail2ban'
|
|
||||||
- 'lynis'
|
|
||||||
open_services:
|
|
||||||
- { name: 'ssh', proto: 'tcp' }
|
|
||||||
- { name: 'http', proto: 'tcp' }
|
|
||||||
- { name: 'https', proto: 'tcp' }
|
|
||||||
custom_scripts:
|
|
||||||
- 'crowdsec.sh'
|
|
||||||
- 'add_user_ssh.sh'
|
|
||||||
- 'fix_permissions.sh'
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
0) Anything inside < and > for example <service name> is a bit of text you provide so if I say "<password>" you would replace with something like "password123"
|
|
||||||
1) acquire btc
|
|
||||||
spot app
|
|
||||||
coinmama
|
|
||||||
2) tumble btc deep web
|
|
||||||
3) put btc in deep web wallet
|
|
||||||
4) launch host on bithost
|
|
||||||
https://bithost.io
|
|
||||||
// Ubuntu 20.04 LTS with minimum 1gb RAM
|
|
||||||
5) lock down bitohst jump box to VPN IP
|
|
||||||
6) generate keys on bithost
|
|
||||||
5) get key from sporehost and launch server
|
|
||||||
http://spore64i5sofqlfz5gq2ju4msgzojjwifls7rok2cti624zyq3fcelad.onion/
|
|
||||||
6) log in from bithost on VPN
|
|
||||||
sudo -i
|
|
||||||
apt update
|
|
||||||
apt upgrade
|
|
||||||
ufw allow ssh
|
|
||||||
ufw enable
|
|
||||||
apt install apache2 tor mysql-server php libapache2-mod-php php-mysql php-curl php-gd screen iotop zip unzip lynx htop chkrootkit lynis certbot fail2ban python3 python3-pip curl nmap
|
|
||||||
a2enmod ssl
|
|
||||||
systemctl restart apache2
|
|
||||||
mysql_secure_installation
|
|
||||||
password validation: 2
|
|
||||||
// update phpmyadmin repo/install from git pull
|
|
||||||
// this is a workaround for an old phpmyadmin repo on the 20.04 LTS
|
|
||||||
// mysql -h localhost -u root -p
|
|
||||||
// UNINSTALL COMPONENT 'file://component_validate_password';
|
|
||||||
// CREATE USER 'rootuser'@'localhost' IDENTIFIED BY '<Secure Password>'; // REMEMBER THIS PASSWORD
|
|
||||||
// GRANT ALL PRIVILEGES ON *.* TO 'rootuser'@'localhost';
|
|
||||||
// FLUSH PRIVILEGES;
|
|
||||||
// quit;
|
|
||||||
apt install phpmyadmin //change to git pull OR updated manual repo
|
|
||||||
[x] apache2
|
|
||||||
[x] YES
|
|
||||||
[Secure Password] // REMEMBER THIS PASSWORD
|
|
||||||
cd /var/www/html
|
|
||||||
ln -s /usr/share/phpmyadmin
|
|
||||||
mv phpmyadmin pma
|
|
||||||
//to access phpmyadmin, go to http://<ip address>/pma //log in with user rootuser and your password from before
|
|
||||||
systemctl enable tor
|
|
||||||
systemctl start tor
|
|
||||||
mkdir /var/www/<servicename>
|
|
||||||
nano /etc/tor/torrc
|
|
||||||
Ctrl+W "hidden"
|
|
||||||
>uncomment hidden service 127.0.0.1:80
|
|
||||||
>uncomment hidden service dir, name /var/lib/tor/<servicename>
|
|
||||||
Ctrl+X
|
|
||||||
Y
|
|
||||||
systemctl restart tor
|
|
||||||
comment out logging
|
|
||||||
nano /etc/apache2/sites-available/<service name>.conf
|
|
||||||
|
|
||||||
<VirtualHost localhost:80>
|
|
||||||
DocumentRoot /var/www/<servicename>
|
|
||||||
</VirtualHost>
|
|
||||||
Ctrl+X
|
|
||||||
Y
|
|
||||||
a2ensite <service name>
|
|
||||||
systemctl restart apache2
|
|
||||||
cat /var/lib/tor/<service name>/hostname
|
|
||||||
save onion address, its your hostname!
|
|
||||||
// scallion
|
|
||||||
|
|
||||||
|
|
||||||
mkdir /usr/share/scripts
|
|
||||||
nano /usr/share/scripts/perms.sh
|
|
||||||
```
|
|
||||||
#!/bin/bash
|
|
||||||
chown -R www-data:www-data /var/www/*
|
|
||||||
find /var/www/* -type d -exec chmod g=rwx "{}" \;
|
|
||||||
find /var/www/* -type f -exec chmod g=rw "{}" \;
|
|
||||||
```
|
|
||||||
Ctrl+X
|
|
||||||
Y
|
|
||||||
chmod +x /usr/share/scripts/perms.sh
|
|
||||||
sh /usr/share/scripts/perms.sh
|
|
||||||
crontab -e
|
|
||||||
1
|
|
||||||
at bottom add
|
|
||||||
```
|
|
||||||
0 8 * * * chkrootkit -q
|
|
||||||
0 11 * * 0 lynis -q
|
|
||||||
0 */6 * * * apt update; apt -y upgrade;
|
|
||||||
```
|
|
||||||
Ctrl+X
|
|
||||||
Y
|
|
||||||
@@ -1,84 +0,0 @@
|
|||||||
1) acquire btc
|
|
||||||
spot app
|
|
||||||
coinmama
|
|
||||||
2) tumble btc deep web
|
|
||||||
3) put btc in deep web wallet
|
|
||||||
4) launch host on bithost
|
|
||||||
https://bithost.io
|
|
||||||
// Ubuntu 20.04 LTS with minimum 1gb RAM
|
|
||||||
5) lock down bitohst jump box to VPN IP
|
|
||||||
6) generate keys on bithost
|
|
||||||
5) get key from sporehost and launch server
|
|
||||||
http://spore64i5sofqlfz5gq2ju4msgzojjwifls7rok2cti624zyq3fcelad.onion/
|
|
||||||
6) log in from bithost on VPN
|
|
||||||
sudo -i
|
|
||||||
apt update
|
|
||||||
apt upgrade
|
|
||||||
ufw allow ssh
|
|
||||||
ufw enable
|
|
||||||
apt install apache2 tor mysql-server php libapache2-mod-php php-mysql php-curl php-gd screen iotop zip unzip lynx htop chkrootkit lynis certbot fail2ban python3 python3-pip curl nmap
|
|
||||||
a2enmod sslsystemctl restart apache2
|
|
||||||
mysql_secure_installation
|
|
||||||
password validation: 2
|
|
||||||
// this is a workaround for an old phpmyadmin repo on the 20.04 LTS
|
|
||||||
// mysql -h localhost -u root -p
|
|
||||||
// UNINSTALL COMPONENT 'file://component_validate_password';
|
|
||||||
// CREATE USER 'rootuser'@'localhost' IDENTIFIED BY '<Secure Password>'; // REMEMBER THIS PASSWORD
|
|
||||||
// GRANT ALL PRIVILEGES ON *.* TO 'rootuser'@'localhost';
|
|
||||||
// FLUSH PRIVILEGES;
|
|
||||||
// quit;
|
|
||||||
apt install phpmyadmin //change to git pull OR updated manual repo
|
|
||||||
[x] apache2
|
|
||||||
[x] YES
|
|
||||||
[Secure Password] // REMEMBER THIS PASSWORD
|
|
||||||
cd /var/www/html
|
|
||||||
ln -s /usr/share/phpmyadmin
|
|
||||||
mv phpmyadmin pma
|
|
||||||
//to access phpmyadmin, go to http://<ip address>/pma //log in with user rootuser and your password from before
|
|
||||||
systemctl enable tor
|
|
||||||
systemctl start tor
|
|
||||||
mkdir /var/www/<servicename>
|
|
||||||
nano /etc/tor/torrc
|
|
||||||
Ctrl+W "hidden"
|
|
||||||
>uncomment hidden service 127.0.0.1:80
|
|
||||||
>uncomment hidden service dir, name /var/lib/tor/<servicename>
|
|
||||||
Ctrl+X
|
|
||||||
Y
|
|
||||||
systemctl restart tor
|
|
||||||
comment out logging
|
|
||||||
nano /etc/apache2/sites-available/<service name>.conf
|
|
||||||
|
|
||||||
<VirtualHost localhost:80>
|
|
||||||
DocumentRoot /var/www/<servicename>
|
|
||||||
</VirtualHost>
|
|
||||||
Ctrl+X
|
|
||||||
Y
|
|
||||||
a2ensite <service name>
|
|
||||||
systemctl restart apache2
|
|
||||||
cat /var/lib/tor/<service name>/hostname
|
|
||||||
save onion address, its your hostname!
|
|
||||||
// scallion
|
|
||||||
|
|
||||||
|
|
||||||
mkdir /usr/share/scripts
|
|
||||||
nano /usr/share/scripts/perms.sh
|
|
||||||
```
|
|
||||||
#!/bin/bash
|
|
||||||
chown -R www-data:www-data /var/www/*
|
|
||||||
find /var/www/* -type d -exec chmod g=rwx "{}" \;
|
|
||||||
find /var/www/* -type f -exec chmod g=rw "{}" \;
|
|
||||||
```
|
|
||||||
Ctrl+X
|
|
||||||
Y
|
|
||||||
chmod +x /usr/share/scripts/perms.sh
|
|
||||||
sh /usr/share/scripts/perms.sh
|
|
||||||
crontab -e
|
|
||||||
1
|
|
||||||
at bottom add
|
|
||||||
```
|
|
||||||
0 8 * * * chkrootkit -q
|
|
||||||
0 11 * * 0 lynis -q
|
|
||||||
0 */6 * * * apt update; apt -y upgrade;
|
|
||||||
```
|
|
||||||
Ctrl+X
|
|
||||||
Y
|
|
||||||
@@ -0,0 +1,121 @@
|
|||||||
|
Creative Commons Legal Code
|
||||||
|
|
||||||
|
CC0 1.0 Universal
|
||||||
|
|
||||||
|
CREATIVE COMMONS CORPORATION IS NOT A LAW FIRM AND DOES NOT PROVIDE
|
||||||
|
LEGAL SERVICES. DISTRIBUTION OF THIS DOCUMENT DOES NOT CREATE AN
|
||||||
|
ATTORNEY-CLIENT RELATIONSHIP. CREATIVE COMMONS PROVIDES THIS
|
||||||
|
INFORMATION ON AN "AS-IS" BASIS. CREATIVE COMMONS MAKES NO WARRANTIES
|
||||||
|
REGARDING THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS
|
||||||
|
PROVIDED HEREUNDER, AND DISCLAIMS LIABILITY FOR DAMAGES RESULTING FROM
|
||||||
|
THE USE OF THIS DOCUMENT OR THE INFORMATION OR WORKS PROVIDED
|
||||||
|
HEREUNDER.
|
||||||
|
|
||||||
|
Statement of Purpose
|
||||||
|
|
||||||
|
The laws of most jurisdictions throughout the world automatically confer
|
||||||
|
exclusive Copyright and Related Rights (defined below) upon the creator
|
||||||
|
and subsequent owner(s) (each and all, an "owner") of an original work of
|
||||||
|
authorship and/or a database (each, a "Work").
|
||||||
|
|
||||||
|
Certain owners wish to permanently relinquish those rights to a Work for
|
||||||
|
the purpose of contributing to a commons of creative, cultural and
|
||||||
|
scientific works ("Commons") that the public can reliably and without fear
|
||||||
|
of later claims of infringement build upon, modify, incorporate in other
|
||||||
|
works, reuse and redistribute as freely as possible in any form whatsoever
|
||||||
|
and for any purposes, including without limitation commercial purposes.
|
||||||
|
These owners may contribute to the Commons to promote the ideal of a free
|
||||||
|
culture and the further production of creative, cultural and scientific
|
||||||
|
works, or to gain reputation or greater distribution for their Work in
|
||||||
|
part through the use and efforts of others.
|
||||||
|
|
||||||
|
For these and/or other purposes and motivations, and without any
|
||||||
|
expectation of additional consideration or compensation, the person
|
||||||
|
associating CC0 with a Work (the "Affirmer"), to the extent that he or she
|
||||||
|
is an owner of Copyright and Related Rights in the Work, voluntarily
|
||||||
|
elects to apply CC0 to the Work and publicly distribute the Work under its
|
||||||
|
terms, with knowledge of his or her Copyright and Related Rights in the
|
||||||
|
Work and the meaning and intended legal effect of CC0 on those rights.
|
||||||
|
|
||||||
|
1. Copyright and Related Rights. A Work made available under CC0 may be
|
||||||
|
protected by copyright and related or neighboring rights ("Copyright and
|
||||||
|
Related Rights"). Copyright and Related Rights include, but are not
|
||||||
|
limited to, the following:
|
||||||
|
|
||||||
|
i. the right to reproduce, adapt, distribute, perform, display,
|
||||||
|
communicate, and translate a Work;
|
||||||
|
ii. moral rights retained by the original author(s) and/or performer(s);
|
||||||
|
iii. publicity and privacy rights pertaining to a person's image or
|
||||||
|
likeness depicted in a Work;
|
||||||
|
iv. rights protecting against unfair competition in regards to a Work,
|
||||||
|
subject to the limitations in paragraph 4(a), below;
|
||||||
|
v. rights protecting the extraction, dissemination, use and reuse of data
|
||||||
|
in a Work;
|
||||||
|
vi. database rights (such as those arising under Directive 96/9/EC of the
|
||||||
|
European Parliament and of the Council of 11 March 1996 on the legal
|
||||||
|
protection of databases, and under any national implementation
|
||||||
|
thereof, including any amended or successor version of such
|
||||||
|
directive); and
|
||||||
|
vii. other similar, equivalent or corresponding rights throughout the
|
||||||
|
world based on applicable law or treaty, and any national
|
||||||
|
implementations thereof.
|
||||||
|
|
||||||
|
2. Waiver. To the greatest extent permitted by, but not in contravention
|
||||||
|
of, applicable law, Affirmer hereby overtly, fully, permanently,
|
||||||
|
irrevocably and unconditionally waives, abandons, and surrenders all of
|
||||||
|
Affirmer's Copyright and Related Rights and associated claims and causes
|
||||||
|
of action, whether now known or unknown (including existing as well as
|
||||||
|
future claims and causes of action), in the Work (i) in all territories
|
||||||
|
worldwide, (ii) for the maximum duration provided by applicable law or
|
||||||
|
treaty (including future time extensions), (iii) in any current or future
|
||||||
|
medium and for any number of copies, and (iv) for any purpose whatsoever,
|
||||||
|
including without limitation commercial, advertising or promotional
|
||||||
|
purposes (the "Waiver"). Affirmer makes the Waiver for the benefit of each
|
||||||
|
member of the public at large and to the detriment of Affirmer's heirs and
|
||||||
|
successors, fully intending that such Waiver shall not be subject to
|
||||||
|
revocation, rescission, cancellation, termination, or any other legal or
|
||||||
|
equitable action to disrupt the quiet enjoyment of the Work by the public
|
||||||
|
as contemplated by Affirmer's express Statement of Purpose.
|
||||||
|
|
||||||
|
3. Public License Fallback. Should any part of the Waiver for any reason
|
||||||
|
be judged legally invalid or ineffective under applicable law, then the
|
||||||
|
Waiver shall be preserved to the maximum extent permitted taking into
|
||||||
|
account Affirmer's express Statement of Purpose. In addition, to the
|
||||||
|
extent the Waiver is so judged Affirmer hereby grants to each affected
|
||||||
|
person a royalty-free, non transferable, non sublicensable, non exclusive,
|
||||||
|
irrevocable and unconditional license to exercise Affirmer's Copyright and
|
||||||
|
Related Rights in the Work (i) in all territories worldwide, (ii) for the
|
||||||
|
maximum duration provided by applicable law or treaty (including future
|
||||||
|
time extensions), (iii) in any current or future medium and for any number
|
||||||
|
of copies, and (iv) for any purpose whatsoever, including without
|
||||||
|
limitation commercial, advertising or promotional purposes (the
|
||||||
|
"License"). The License shall be deemed effective as of the date CC0 was
|
||||||
|
applied by Affirmer to the Work. Should any part of the License for any
|
||||||
|
reason be judged legally invalid or ineffective under applicable law, such
|
||||||
|
partial invalidity or ineffectiveness shall not invalidate the remainder
|
||||||
|
of the License, and in such case Affirmer hereby affirms that he or she
|
||||||
|
will not (i) exercise any of his or her remaining Copyright and Related
|
||||||
|
Rights in the Work or (ii) assert any associated claims and causes of
|
||||||
|
action with respect to the Work, in either case contrary to Affirmer's
|
||||||
|
express Statement of Purpose.
|
||||||
|
|
||||||
|
4. Limitations and Disclaimers.
|
||||||
|
|
||||||
|
a. No trademark or patent rights held by Affirmer are waived, abandoned,
|
||||||
|
surrendered, licensed or otherwise affected by this document.
|
||||||
|
b. Affirmer offers the Work as-is and makes no representations or
|
||||||
|
warranties of any kind concerning the Work, express, implied,
|
||||||
|
statutory or otherwise, including without limitation warranties of
|
||||||
|
title, merchantability, fitness for a particular purpose, non
|
||||||
|
infringement, or the absence of latent or other defects, accuracy, or
|
||||||
|
the present or absence of errors, whether or not discoverable, all to
|
||||||
|
the greatest extent permissible under applicable law.
|
||||||
|
c. Affirmer disclaims responsibility for clearing rights of other persons
|
||||||
|
that may apply to the Work or any use thereof, including without
|
||||||
|
limitation any person's Copyright and Related Rights in the Work.
|
||||||
|
Further, Affirmer disclaims responsibility for obtaining any necessary
|
||||||
|
consents, permissions or other rights required for any use of the
|
||||||
|
Work.
|
||||||
|
d. Affirmer understands and acknowledges that Creative Commons is not a
|
||||||
|
party to this document and has no duty or obligation with respect to
|
||||||
|
this CC0 or use of the Work.
|
||||||
@@ -1,123 +0,0 @@
|
|||||||
#IPTABLES RULES
|
|
||||||
iptables -A INPUT -p tcp -m tcp --tcp-flags RST RST -m limit --limit 2/second --limit-burst 2 -j ACCEPT
|
|
||||||
iptables -t mangle -A PREROUTING -p tcp ! --syn -m conntrack --ctstate NEW -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -p tcp -m conntrack --ctstate NEW -m tcpmss ! --mss 536:65535 -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -p tcp --tcp-flags FIN,SYN,RST,PSH,ACK,URG NONE -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -p tcp --tcp-flags FIN,SYN FIN,SYN -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -p tcp --tcp-flags SYN,RST SYN,RST -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -p tcp --tcp-flags FIN,RST FIN,RST -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -p tcp --tcp-flags FIN,ACK FIN -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -p tcp --tcp-flags ACK,URG URG -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -p tcp --tcp-flags ACK,FIN FIN -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -p tcp --tcp-flags ACK,PSH PSH -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -p tcp --tcp-flags ALL ALL -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -p tcp --tcp-flags ALL NONE -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -p tcp --tcp-flags ALL FIN,PSH,URG -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -p tcp --tcp-flags ALL SYN,FIN,PSH,URG -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -p tcp --tcp-flags ALL SYN,RST,ACK,FIN,URG -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -s 224.0.0.0/3 -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -s 169.254.0.0/16 -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -s 172.16.0.0/12 -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -s 192.0.2.0/24 -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -s 192.168.0.0/16 -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -s 10.0.0.0/8 -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -s 0.0.0.0/8 -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -s 240.0.0.0/5 -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -s 127.0.0.0/8 ! -i lo -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -p icmp -j DROP
|
|
||||||
iptables -A INPUT -p tcp -m connlimit --connlimit-above 80 -j REJECT --reject-with tcp-reset
|
|
||||||
iptables -A INPUT -p tcp -m conntrack --ctstate NEW -m limit --limit 60/s --limit-burst 20 -j ACCEPT
|
|
||||||
iptables -A INPUT -p tcp -m conntrack --ctstate NEW -j DROP
|
|
||||||
iptables -t mangle -A PREROUTING -f -j DROP
|
|
||||||
iptables -A INPUT -p tcp --tcp-flags RST RST -m limit --limit 2/s --limit-burst 2 -j ACCEPT
|
|
||||||
iptables -A INPUT -p tcp --tcp-flags RST RST -j DROP
|
|
||||||
iptables -t raw -A PREROUTING -p tcp -m tcp --syn -j CT --notrack
|
|
||||||
iptables -A INPUT -p tcp -m tcp -m conntrack --ctstate INVALID,UNTRACKED -j SYNPROXY --sack-perm --timestamp --wscale 7 --mss 1460
|
|
||||||
iptables -A INPUT -m conntrack --ctstate INVALID -j DROP
|
|
||||||
iptables -A INPUT -p tcp --dport ssh -m conntrack --ctstate NEW -m recent --set
|
|
||||||
iptables -A INPUT -p tcp --dport ssh -m conntrack --ctstate NEW -m recent --update --seconds 60 --hitcount 10 -j DROP
|
|
||||||
iptables -N port-scanning
|
|
||||||
iptables -A port-scanning -p tcp --tcp-flags SYN,ACK,FIN,RST RST -m limit --limit 1/s --limit-burst 2 -j RETURN
|
|
||||||
iptables -A port-scanning -j DROP
|
|
||||||
iptables -A INPUT -p tcp -m tcp --dport 139 -m recent --name portscan --set -j LOG --log-prefix "portscan:"
|
|
||||||
iptables -A INPUT -p tcp -m tcp --dport 139 -m recent --name portscan --set -j DROP
|
|
||||||
iptables -A FORWARD -p tcp -m tcp --dport 139 -m recent --name portscan --set -j LOG --log-prefix "portscan:"
|
|
||||||
iptables -A FORWARD -p tcp -m tcp --dport 139 -m recent --name portscan --set -j DROP
|
|
||||||
iptables -A INPUT -m recent --name portscan --remove
|
|
||||||
iptables -A FORWARD -m recent --name portscan --remove
|
|
||||||
iptables -A INPUT -m recent --name portscan --rcheck --seconds 86400 -j DROP
|
|
||||||
iptables -A FORWARD -m recent --name portscan --rcheck --seconds 86400 -j DROP
|
|
||||||
|
|
||||||
#KERNEL RULES
|
|
||||||
kernel.printk = 4 4 1 7
|
|
||||||
kernel.panic = 10
|
|
||||||
kernel.sysrq = 0
|
|
||||||
kernel.shmmax = 4294967296
|
|
||||||
kernel.shmall = 4194304
|
|
||||||
kernel.core_uses_pid = 1
|
|
||||||
kernel.msgmnb = 65536
|
|
||||||
kernel.msgmax = 65536
|
|
||||||
vm.swappiness = 20
|
|
||||||
vm.dirty_ratio = 80
|
|
||||||
vm.dirty_background_ratio = 5
|
|
||||||
fs.file-max = 2097152
|
|
||||||
net.core.netdev_max_backlog = 262144
|
|
||||||
net.core.rmem_default = 31457280
|
|
||||||
net.core.rmem_max = 67108864
|
|
||||||
net.core.wmem_default = 31457280
|
|
||||||
net.core.wmem_max = 67108864
|
|
||||||
net.core.somaxconn = 65535
|
|
||||||
net.core.optmem_max = 25165824
|
|
||||||
net.ipv4.neigh.default.gc_thresh1 = 4096
|
|
||||||
net.ipv4.neigh.default.gc_thresh2 = 8192
|
|
||||||
net.ipv4.neigh.default.gc_thresh3 = 16384
|
|
||||||
net.ipv4.neigh.default.gc_interval = 5
|
|
||||||
net.ipv4.neigh.default.gc_stale_time = 120
|
|
||||||
net.netfilter.nf_conntrack_max = 10000000
|
|
||||||
net.netfilter.nf_conntrack_tcp_loose = 0
|
|
||||||
net.netfilter.nf_conntrack_tcp_timeout_established = 1800
|
|
||||||
net.netfilter.nf_conntrack_tcp_timeout_close = 10
|
|
||||||
net.netfilter.nf_conntrack_tcp_timeout_close_wait = 10
|
|
||||||
net.netfilter.nf_conntrack_tcp_timeout_fin_wait = 20
|
|
||||||
net.netfilter.nf_conntrack_tcp_timeout_last_ack = 20
|
|
||||||
net.netfilter.nf_conntrack_tcp_timeout_syn_recv = 20
|
|
||||||
net.netfilter.nf_conntrack_tcp_timeout_syn_sent = 20
|
|
||||||
net.netfilter.nf_conntrack_tcp_timeout_time_wait = 10
|
|
||||||
net.ipv4.tcp_slow_start_after_idle = 0
|
|
||||||
net.ipv4.ip_local_port_range = 1024 65000
|
|
||||||
net.ipv4.ip_no_pmtu_disc = 1
|
|
||||||
net.ipv4.route.flush = 1
|
|
||||||
net.ipv4.route.max_size = 8048576
|
|
||||||
net.ipv4.icmp_echo_ignore_broadcasts = 1
|
|
||||||
net.ipv4.icmp_ignore_bogus_error_responses = 1
|
|
||||||
net.ipv4.tcp_congestion_control = htcp
|
|
||||||
net.ipv4.tcp_mem = 65536 131072 262144
|
|
||||||
net.ipv4.udp_mem = 65536 131072 262144
|
|
||||||
net.ipv4.tcp_rmem = 4096 87380 33554432
|
|
||||||
net.ipv4.udp_rmem_min = 16384
|
|
||||||
net.ipv4.tcp_wmem = 4096 87380 33554432
|
|
||||||
net.ipv4.udp_wmem_min = 16384
|
|
||||||
net.ipv4.tcp_max_tw_buckets = 1440000
|
|
||||||
net.ipv4.tcp_tw_recycle = 0
|
|
||||||
net.ipv4.tcp_tw_reuse = 1
|
|
||||||
net.ipv4.tcp_max_orphans = 400000
|
|
||||||
net.ipv4.tcp_window_scaling = 1
|
|
||||||
net.ipv4.tcp_rfc1337 = 1
|
|
||||||
net.ipv4.tcp_syncookies = 1
|
|
||||||
net.ipv4.tcp_synack_retries = 1
|
|
||||||
net.ipv4.tcp_syn_retries = 2
|
|
||||||
net.ipv4.tcp_max_syn_backlog = 16384
|
|
||||||
net.ipv4.tcp_timestamps = 1
|
|
||||||
net.ipv4.tcp_sack = 1
|
|
||||||
net.ipv4.tcp_fack = 1
|
|
||||||
net.ipv4.tcp_ecn = 2
|
|
||||||
net.ipv4.tcp_fin_timeout = 10
|
|
||||||
net.ipv4.tcp_keepalive_time = 600
|
|
||||||
net.ipv4.tcp_keepalive_intvl = 60
|
|
||||||
net.ipv4.tcp_keepalive_probes = 10
|
|
||||||
net.ipv4.tcp_no_metrics_save = 1
|
|
||||||
net.ipv4.ip_forward = 1
|
|
||||||
net.ipv4.conf.all.accept_redirects = 0
|
|
||||||
net.ipv4.conf.all.send_redirects = 0
|
|
||||||
net.ipv4.conf.all.accept_source_route = 0
|
|
||||||
net.ipv4.conf.all.rp_filter = 1
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
<VirtualHost $IP:443>
|
|
||||||
DocumentRoot /var/www/$DOMAIN
|
|
||||||
ServerName $DOMAIN
|
|
||||||
SSLEngine on
|
|
||||||
SSLCertificateFile /etc/letsencrypt/live/$DOMAIN/fullchain.pem
|
|
||||||
SSLCertificateKeyFile /etc/letsencrypt/live/$DOMAIN/privkey.pem
|
|
||||||
SSLProtocol all -SSLv2 -SSLv3
|
|
||||||
SSLHonorCipherOrder on
|
|
||||||
SSLCipherSuite "HIGH:!aNULL:!MD5:!3DES:!CAMELLIA:!AES128"
|
|
||||||
SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
|
|
||||||
</VirtualHost>
|
|
||||||
|
|
||||||
<VirtualHost $IP:80>
|
|
||||||
ServerName $DOMAIN
|
|
||||||
Redirect permanent / https://$DOMAIN/
|
|
||||||
</VirtualHost>
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
0 8 * * * chkrootkit -q
|
|
||||||
0 11 * * 0 lynis -q
|
|
||||||
0 0 * * * apt update; apt upgrade -y
|
|
||||||
@@ -1,148 +0,0 @@
|
|||||||
Ubuntu 24.04.3LTS
|
|
||||||
PHP-default
|
|
||||||
Apache2
|
|
||||||
MySQL+phpmyadmin
|
|
||||||
|
|
||||||
# Step 1
|
|
||||||
sudo -i
|
|
||||||
apt update
|
|
||||||
apt -y upgrade
|
|
||||||
reboot
|
|
||||||
|
|
||||||
# Step 2
|
|
||||||
nano /etc/ssh/sshd_config
|
|
||||||
Change `#PasswordAuthentication yes` to `PasswordAuthentication no`
|
|
||||||
Add line
|
|
||||||
`AllowUsers <username>`
|
|
||||||
|
|
||||||
# Step 3
|
|
||||||
ON WINDOWS:
|
|
||||||
Via PowerShell
|
|
||||||
enable OpenSSH in PowerShell: https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse
|
|
||||||
ssh-keygen -t ed25519 -C "<your email address>"
|
|
||||||
use a STRONG PASSPHRASE
|
|
||||||
Hit [Enter] to save keys at DEFAULT location
|
|
||||||
to get your rsa PUBLIC key, do:
|
|
||||||
Press [Windows Logo Key/Start]+R
|
|
||||||
Put in `notepad %USERPROFILE%/.ssh/id_ed25519.pub`
|
|
||||||
hit Enter
|
|
||||||
copy all the text in that file
|
|
||||||
# Technical details: it saves private key at %USERPROFILE%/.ssh/id_ed25519
|
|
||||||
# private key example: C:\Users\potatouser\.ssh\id_ed25519
|
|
||||||
# public key example: C:\Users\potatouser\.ssh\id_ed25519.pub
|
|
||||||
|
|
||||||
|
|
||||||
ON UBUNTU
|
|
||||||
mkdir ~/.ssh
|
|
||||||
chmod 700 ~/.ssh
|
|
||||||
nano ~/.ssh/authorized_keys
|
|
||||||
<paste rsa PUBLIC key>
|
|
||||||
chmod 600 ~/.ssh/authorized_keys
|
|
||||||
sudo systemctl reload sshd
|
|
||||||
|
|
||||||
TO CONNECT
|
|
||||||
SSH with Windows PowerShell
|
|
||||||
Powershell is installed by default on Windows 10/11
|
|
||||||
ssh <username>@<ipaddress>
|
|
||||||
|
|
||||||
Manage Files with WinSCP:
|
|
||||||
install winscp https://winscp.net/eng/download.php
|
|
||||||
install puttygen https://www.puttygen.com/download.php?val=4
|
|
||||||
run puttygen
|
|
||||||
Click Load
|
|
||||||
Select private key at %USERPROFILE%/.ssh/id_ed25519
|
|
||||||
copy and paste the string of text beginning in ssh-ed25519 and paste
|
|
||||||
save public and private key to %USERPROFILE%/.ssh/ under a %USERPROFILE%/.ssh/id_ed25519.ppk (private)
|
|
||||||
and %USERPROFILE%/.ssh/id_ed25519.ppk.pub (public)
|
|
||||||
run winscp
|
|
||||||
click new site
|
|
||||||
protocol: SFTP
|
|
||||||
host name: <server/ip>
|
|
||||||
username: <username>
|
|
||||||
port number: 22
|
|
||||||
click Advanced
|
|
||||||
on left panel under SSH click Authentication
|
|
||||||
Browse for private key at %USERPROFILE%/.ssh/id_ed25519.ppk
|
|
||||||
ok
|
|
||||||
save
|
|
||||||
|
|
||||||
# Step 4
|
|
||||||
sudo apt install -y git
|
|
||||||
# download and install scripts and tools
|
|
||||||
cd ~
|
|
||||||
git clone https://github.com/PrincessPi3/general-scripts-and-system-ssssssetup.git
|
|
||||||
sudo -i
|
|
||||||
apt install -y apache2 snapd mysql-server byobu nmap screen iotop zip unzip lynx htop php php-cli php-fpm php-json php-common php-mysql php-zip php-gd php-mbstring php-curl php-xml php-pear php-bcmath unattended-upgrades net-tools python3 python3-pip unison
|
|
||||||
snap install btop
|
|
||||||
# secure mysql
|
|
||||||
mysql_secure_installation
|
|
||||||
# follow directions, defaults are fine just remember what you set as the root password
|
|
||||||
# install and config phpmyadmin
|
|
||||||
apt install -y phpmyadmin
|
|
||||||
ln -s /usr/share/phpmyadmin /var/www/html/pma
|
|
||||||
# phpmyadmin will be accessable from the public internet at http://<your server ip>/pma
|
|
||||||
# ensure your passwords are up to snuff
|
|
||||||
// TODO: prolly should do some other security shit to protect phpmyadmin
|
|
||||||
systemctl restart apache2
|
|
||||||
systemctl restart mysql
|
|
||||||
# add user to web server group
|
|
||||||
usermod -a -G www-data <username>
|
|
||||||
# unattended upgrades
|
|
||||||
dpkg-reconfigure unattended-upgrades
|
|
||||||
nano /etc/apt/apt.conf.d/50unattended-upgrades
|
|
||||||
change `//Unattended-Upgrade::Automatic-Reboot "false";` to `Unattended-Upgrade::Automatic-Reboot "true";`
|
|
||||||
change `//Unattended-Upgrade::Remove-Unused-Dependencies "false";` to `Unattended-Upgrade::Remove-Unused-Dependencies "true";`
|
|
||||||
change `//Unattended-Upgrade::Mail "root@localhost";` to Unattended-Upgrade::Mail "<your admin email>";`
|
|
||||||
systemctl start unattended-upgrades && systemctl enable unattended-upgrades
|
|
||||||
unattended-upgrade -d -v //test unattended upgrades
|
|
||||||
# uncomplicated firewall setup
|
|
||||||
ufw allow http
|
|
||||||
ufw allow https
|
|
||||||
ufw allow ssh
|
|
||||||
ufw enable
|
|
||||||
reboot
|
|
||||||
|
|
||||||
|
|
||||||
// TODO: backups setup needs more work, not working at current
|
|
||||||
// make unison script pls
|
|
||||||
// SKIP backups section for now
|
|
||||||
# backups
|
|
||||||
sudo -i
|
|
||||||
mkdir -p /backups/log
|
|
||||||
mkdir /backups/backups
|
|
||||||
ln -s /var/backups /backups/system
|
|
||||||
cp -r /home/<user>/general-scripts-and-system-ssssssetup/customscripts /usr/share
|
|
||||||
chmod +x /usr/share/customscripts/*sh
|
|
||||||
nano /usr/share/customscripts/backup.sh //edit to add dirs to back up
|
|
||||||
sh /usr/share/customscripts/crowdsec.sh
|
|
||||||
screen -R backups
|
|
||||||
sh /usr/share/customscripts/backup.sh
|
|
||||||
Ctrl+A+D
|
|
||||||
sh /usr/share/customscripts/fix_permissions.sh
|
|
||||||
|
|
||||||
# Step 5
|
|
||||||
# install some cool securiy tools
|
|
||||||
apt install -y chkrootkit lynis certbot fail2ban
|
|
||||||
crontab -e //instal crons from /home/<user>/general-scripts-and-system-ssssssetup/crontab.txt
|
|
||||||
apt install -y tripwire
|
|
||||||
Follow directions and utilize secure passphrase DO NOT LOSE PASSPHRASE
|
|
||||||
# as primary user (NOT root or sudo, run `exit` if in doubt)
|
|
||||||
pip3 install thefuck
|
|
||||||
echo "# user addons" >> ~/.bashrc
|
|
||||||
echo "PATH=~/.local/bin/:$PATH" >> ~/.bashrc
|
|
||||||
echo 'eval "$(thefuck --alias)"' >> ~/.bashrc
|
|
||||||
echo 'HISTTIMEFORMAT="%Y-%m-%d %T "' >> ~/.bashrc
|
|
||||||
source ~/.bashrc
|
|
||||||
|
|
||||||
Step 6: # optional
|
|
||||||
IF you want to use sudo without password check:
|
|
||||||
sudo visudo
|
|
||||||
for ONE user:
|
|
||||||
select editor of your choice
|
|
||||||
add `<username> ALL=(ALL) NOPASSWD: ALL`
|
|
||||||
|
|
||||||
OR for all users in the sudo group
|
|
||||||
comment out the line beginning with %sudo soi it looks like #%sudo
|
|
||||||
add `%sudo ALL=(ALL) NOPASSWD: ALL` on any new line
|
|
||||||
save and exit
|
|
||||||
sudo reboot
|
|
||||||
@@ -1,109 +1,3 @@
|
|||||||
* General Guides and Scripts for:
|
# general-scripts-and-system-ssssssetup
|
||||||
* Ubuntu Server LAMP (20.04 LTS)
|
|
||||||
* Dark Web Hosting (LAMP on 20.04 LTS)
|
|
||||||
* General Windows 10 and mobile security guide
|
|
||||||
|
|
||||||
Install customscripts on linux
|
general scripts and shit
|
||||||
with full upgrade and package install
|
|
||||||
```bash
|
|
||||||
script=/tmp/install_script.sh && curl -s https://git.thecoven.info/PrincessPi/general-scripts-and-system-ssssssetup/raw/branch/main/customscripts/install_script.sh > $script && chmod +x $script && $SHELL -c "$script full" && $SHELL /usr/share/customscripts/configure_webhook.sh full && exec $SHELL
|
|
||||||
```
|
|
||||||
without full upgrade and package install
|
|
||||||
```bash
|
|
||||||
script=/tmp/install_script.sh && curl -s https://git.thecoven.info/PrincessPi/general-scripts-and-system-ssssssetup/raw/branch/main/customscripts/install_script.sh > $script && chmod +x $script && $SHELL -c "$script" && $SHELL /usr/share/customscripts/configure_webhook.sh && exec $SHELL
|
|
||||||
```
|
|
||||||
|
|
||||||
## Usage
|
|
||||||
### Linux
|
|
||||||
#### git helpers
|
|
||||||
* `gitinitshit`
|
|
||||||
* `gitshit`
|
|
||||||
* `gitsync`
|
|
||||||
* `syncstatus`
|
|
||||||
* `waypoint`
|
|
||||||
* `setup_git.sh`
|
|
||||||
|
|
||||||
#### security helpers
|
|
||||||
* `add_user_ssh`
|
|
||||||
* `backup.sh`
|
|
||||||
* `binwalk-tool`
|
|
||||||
* `configuree_webhook.sh`
|
|
||||||
* `connect-wifi`
|
|
||||||
* `crowdsec.sh`
|
|
||||||
* `find_bytes`
|
|
||||||
* `fix-wifi`
|
|
||||||
* `add_user_ssh`
|
|
||||||
* `wifi_monitor`
|
|
||||||
* `wifi-monitor-airX`
|
|
||||||
* `recursive-analysis`
|
|
||||||
* `large_file_search_for_hash`
|
|
||||||
* `randomtoken`
|
|
||||||
* `alfa_install_kali.sh`
|
|
||||||
* `torsilly.sh`
|
|
||||||
|
|
||||||
#### monitoring
|
|
||||||
* `mon-watch`
|
|
||||||
* `monitor_pid`
|
|
||||||
* `ifnet`
|
|
||||||
* `webhook`
|
|
||||||
* `FIND_THE_FUCKING_PI`
|
|
||||||
* `dirstatt`
|
|
||||||
|
|
||||||
#### hosting
|
|
||||||
* `add_apache2_site`
|
|
||||||
|
|
||||||
#### setup and general scripts
|
|
||||||
* `ifnet`
|
|
||||||
* `install_script.sh`
|
|
||||||
* `pyenv_setup`
|
|
||||||
* `python_pyenv_setup.sh`
|
|
||||||
* `xrdp-start`
|
|
||||||
* `add_apache2_site`
|
|
||||||
* `download_file_list`
|
|
||||||
* `download_file_list_raw`
|
|
||||||
* `message_users`
|
|
||||||
* `UNFUCK_HOMEDIR_PERMS.sh`
|
|
||||||
* `pi_create_image`
|
|
||||||
* `pi_create_image_from_img`
|
|
||||||
* `ramdisk_gimme`
|
|
||||||
|
|
||||||
#### for fun
|
|
||||||
* `donut`
|
|
||||||
* `friendlyfriend`
|
|
||||||
* `annoy_the_fuck_out_of_commit_message_nerds`
|
|
||||||
|
|
||||||
#### media
|
|
||||||
* `easylistdownload`
|
|
||||||
* `download_file_list`
|
|
||||||
|
|
||||||
### Windowwz
|
|
||||||
#### git helpers
|
|
||||||
* `gitshit.ps1`
|
|
||||||
* `gitsync.ps1`
|
|
||||||
* `syncstatus.ps1`
|
|
||||||
* `waypoint.ps1`
|
|
||||||
#### linux-like hashing helpers
|
|
||||||
* `winhash.ps1`
|
|
||||||
* `md5sum.ps1`
|
|
||||||
* `sha256sum.ps1`
|
|
||||||
* `sha384sum.ps1`
|
|
||||||
* `sha512sum.ps1`
|
|
||||||
#### remote host tools
|
|
||||||
* `ssh-wait-loop.ps1`
|
|
||||||
* `wait-on-host.ps1`
|
|
||||||
* `testtime.ps1`
|
|
||||||
#### Windows system
|
|
||||||
* `redundant-backup.ps1`
|
|
||||||
#### anti-productivity
|
|
||||||
* `IM_SO_TIRED_BOSS.ps1`
|
|
||||||
|
|
||||||
### Clean up Windows!
|
|
||||||
```powershell
|
|
||||||
iwr https://git.thecoven.info/PrincessPi/general-scripts-and-system-ssssssetup/raw/branch/main/Windows-Scripts/windows-repair.ps1?nocache=$(Get-Random) -OutFile $env:TEMP\windows-repair-temp.ps1; powershell -nop -ep Bypass -File $env:TEMP\windows-repair-temp.ps1
|
|
||||||
```
|
|
||||||
|
|
||||||
todo:
|
|
||||||
1. windwows gitinitshit
|
|
||||||
2. convert windows-repair.bat to powershell and add more features and checks
|
|
||||||
1. automatic elevation request
|
|
||||||
2. update and improve security scan via windows defender
|
|
||||||
@@ -1,115 +0,0 @@
|
|||||||
# Quick and Dirty Methods (Bash)
|
|
||||||
|
|
||||||
colors
|
|
||||||
```bash
|
|
||||||
# Define color variables
|
|
||||||
PINK='\e[35m'
|
|
||||||
BRIGHT_PINK='\e[95m'
|
|
||||||
RED='\033[0;31m'
|
|
||||||
YELLOW='\033[1;33m'
|
|
||||||
GREEN='\033[0;32m'
|
|
||||||
RESET='\033[0m' # No Color (RESET)
|
|
||||||
# usage echo -e "$PINKpinktext here$RESET"
|
|
||||||
```
|
|
||||||
|
|
||||||
standard peak safety with error handling for shell scripts
|
|
||||||
shell script header to exit on error, failed piping, or unset variable while allowing err trap and custom trapping for error
|
|
||||||
```bash
|
|
||||||
#!/bin/bash
|
|
||||||
# set safety optinonz
|
|
||||||
set -o errexit # fail on error
|
|
||||||
set -o errtrace # run trace on error
|
|
||||||
set -o pipefail # fail on pipe fail
|
|
||||||
set -o nounset # fail on unset var
|
|
||||||
|
|
||||||
# save here to use in error_handle function
|
|
||||||
num_of_args="$#"
|
|
||||||
all_args="$@"
|
|
||||||
|
|
||||||
# Define the cleanup function
|
|
||||||
error_handle() {
|
|
||||||
# CRITICAL: Capture the exit status code before ANY other command runs
|
|
||||||
local exit_code=$?
|
|
||||||
local script_path="$(realpath $0)"
|
|
||||||
local hr='===================================================='
|
|
||||||
echo
|
|
||||||
echo $hr
|
|
||||||
echo -e "🚨 \033[0;31m FATAL ERROR DETECTED \033[0m"
|
|
||||||
echo $hr
|
|
||||||
echo "-> Script : $0"
|
|
||||||
echo "-> Num Script Args : $num_of_args"
|
|
||||||
echo "-> Script Args : $all_args"
|
|
||||||
echo "-> Shell : $SHELL"
|
|
||||||
echo "-> Script Path : $script_path"
|
|
||||||
echo "-> Script (full) : $SHELL $script_path $all_args"
|
|
||||||
echo "-> User : $USER"
|
|
||||||
echo "-> Working Directory : $PWD"
|
|
||||||
echo "-> Failed Command : $BASH_COMMAND"
|
|
||||||
echo "-> Line Number : $LINENO"
|
|
||||||
echo "-> Exit Status : $exit_code"
|
|
||||||
echo "-> Seconds Elapsed : $SECONDS"
|
|
||||||
echo "-> Date Failed : $(date)"
|
|
||||||
# Generate a professional, clean stack traceback
|
|
||||||
echo "-> Stack Trace"
|
|
||||||
printf "\t" # to intent da stack trace
|
|
||||||
local frame=0
|
|
||||||
# Loop backwards through the function execution stack array
|
|
||||||
while caller $frame; do
|
|
||||||
printf "\t" # to indenet da stack trace
|
|
||||||
frame=$((frame + 1))
|
|
||||||
done
|
|
||||||
|
|
||||||
# closing niceties
|
|
||||||
echo
|
|
||||||
echo $hr
|
|
||||||
echo
|
|
||||||
|
|
||||||
# exit with last failcode
|
|
||||||
exit "$exit_code"
|
|
||||||
}
|
|
||||||
|
|
||||||
trap error_handle ERR
|
|
||||||
```
|
|
||||||
|
|
||||||
show every set variale and its value (one liner)
|
|
||||||
```bash
|
|
||||||
for v in $(compgen -v); do echo "$v:$$v"; done
|
|
||||||
```
|
|
||||||
|
|
||||||
run command and display error or success
|
|
||||||
```bash
|
|
||||||
<command>; ret=$? && if [ $ret -ne 0 ]; then echo -e "\n\033[0;31mERRROR! Code: $ret\033[0m"; else echo -e "\033[0;32mOK!\033[0m"; fi
|
|
||||||
```
|
|
||||||
|
|
||||||
# Function to Display succ/err based on error code
|
|
||||||
```bash
|
|
||||||
checkcode () {
|
|
||||||
if [ -z "$1" ]; then
|
|
||||||
echo -e "\n\e[31mERROR!\033[0m chkcode missing return code paramater\n"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
retcode=$1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $retcode -ne 0 ]; then
|
|
||||||
echo -e "\t\e[31mERROR!\033[0m Response Code: $retcode"
|
|
||||||
else
|
|
||||||
echo -e "\t\e[1;32mOK!\e[0m"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
```
|
|
||||||
|
|
||||||
Test a list of commands if they are present
|
|
||||||
```bash
|
|
||||||
cmds_to_check=(sha256sum sha1sum md5sum openssl scrypt)
|
|
||||||
for cmd in ${cmds_to_check[@]}; do
|
|
||||||
if command -v $cmd &>/dev/null; then
|
|
||||||
# echo -e "\033[0;32mOK!\033[0m $cmd is present"
|
|
||||||
continue
|
|
||||||
else
|
|
||||||
echo -e "\n\n\033[0;31mERROR!\033[0m $cmd not found! please intall! Exiting!\n\n" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
done
|
|
||||||
echo -e "\033[0;32mOK!\033[0m All Needed Commands Available!"
|
|
||||||
```
|
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
Before Width: | Height: | Size: 104 KiB |
@@ -1,7 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
default_files_name="`printf '%s\n' \"${PWD##*/}\"`_checksums_`date +%Y-%m-%d-%H%M-%Z`.sha256" # add da timedate stamp to it
|
|
||||||
|
|
||||||
echo $default_files_name
|
|
||||||
|
|
||||||
exit 0
|
|
||||||
find $PWD -type f -exec sha256sum {} | tee -a files.sha256
|
|
||||||
@@ -1,178 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>File to Base64 Converter</title>
|
|
||||||
<style>
|
|
||||||
* {
|
|
||||||
box-sizing: border-box;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
background-color: #f4f6f8;
|
|
||||||
color: #333;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
.container {
|
|
||||||
background: #ffffff;
|
|
||||||
border-radius: 12px;
|
|
||||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
|
|
||||||
padding: 30px;
|
|
||||||
width: 100%;
|
|
||||||
max-width: 650px;
|
|
||||||
}
|
|
||||||
h2 {
|
|
||||||
margin-bottom: 20px;
|
|
||||||
font-size: 1.5rem;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.drop-zone {
|
|
||||||
border: 2px dashed #0066ff;
|
|
||||||
border-radius: 8px;
|
|
||||||
padding: 30px;
|
|
||||||
text-align: center;
|
|
||||||
background-color: #f0f7ff;
|
|
||||||
cursor: pointer;
|
|
||||||
transition: background 0.2s ease, border-color 0.2s ease;
|
|
||||||
}
|
|
||||||
.drop-zone:hover, .drop-zone.dragover {
|
|
||||||
background-color: #e1effe;
|
|
||||||
border-color: #0052cc;
|
|
||||||
}
|
|
||||||
.drop-zone p {
|
|
||||||
color: #555;
|
|
||||||
font-size: 0.95rem;
|
|
||||||
}
|
|
||||||
.drop-zone input[type="file"] {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.output-group {
|
|
||||||
margin-top: 25px;
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.output-header {
|
|
||||||
display: flex;
|
|
||||||
justify-content: space-between;
|
|
||||||
align-items: center;
|
|
||||||
margin-bottom: 8px;
|
|
||||||
}
|
|
||||||
label {
|
|
||||||
font-weight: 600;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
}
|
|
||||||
button {
|
|
||||||
background-color: #0066ff;
|
|
||||||
color: white;
|
|
||||||
border: none;
|
|
||||||
padding: 6px 12px;
|
|
||||||
border-radius: 6px;
|
|
||||||
cursor: pointer;
|
|
||||||
font-size: 0.85rem;
|
|
||||||
transition: background 0.2s ease;
|
|
||||||
}
|
|
||||||
button:hover {
|
|
||||||
background-color: #0052cc;
|
|
||||||
}
|
|
||||||
textarea {
|
|
||||||
width: 100%;
|
|
||||||
height: 180px;
|
|
||||||
padding: 12px;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
border-radius: 6px;
|
|
||||||
font-family: monospace;
|
|
||||||
font-size: 0.85rem;
|
|
||||||
resize: vertical;
|
|
||||||
background-color: #fafafa;
|
|
||||||
word-break: break-all;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<h2>File to Base64 Converter</h2>
|
|
||||||
|
|
||||||
<div class="drop-zone" id="dropZone">
|
|
||||||
<p><strong>Click to browse</strong> or drag & drop a file here</p>
|
|
||||||
<input type="file" id="fileInput">
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="output-group" id="outputGroup">
|
|
||||||
<div class="output-header">
|
|
||||||
<label for="base64Output">Base64 Data URL String:</label>
|
|
||||||
<button id="copyBtn">Copy String</button>
|
|
||||||
</div>
|
|
||||||
<textarea id="base64Output" readonly></textarea>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
const dropZone = document.getElementById('dropZone');
|
|
||||||
const fileInput = document.getElementById('fileInput');
|
|
||||||
const outputGroup = document.getElementById('outputGroup');
|
|
||||||
const base64Output = document.getElementById('base64Output');
|
|
||||||
const copyBtn = document.getElementById('copyBtn');
|
|
||||||
|
|
||||||
// Trigger file dialog on click
|
|
||||||
dropZone.addEventListener('click', () => fileInput.click());
|
|
||||||
|
|
||||||
// File input change handler
|
|
||||||
fileInput.addEventListener('change', (e) => {
|
|
||||||
if (e.target.files.length > 0) {
|
|
||||||
processFile(e.target.files[0]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Drag & Drop event handlers
|
|
||||||
dropZone.addEventListener('dragover', (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
dropZone.classList.add('dragover');
|
|
||||||
});
|
|
||||||
|
|
||||||
['dragleave', 'dragend'].forEach(type => {
|
|
||||||
dropZone.addEventListener(type, () => dropZone.classList.remove('dragover'));
|
|
||||||
});
|
|
||||||
|
|
||||||
dropZone.addEventListener('drop', (e) => {
|
|
||||||
e.preventDefault();
|
|
||||||
dropZone.classList.remove('dragover');
|
|
||||||
if (e.dataTransfer.files.length > 0) {
|
|
||||||
processFile(e.dataTransfer.files[0]);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
// Read file as Data URL
|
|
||||||
function processFile(file) {
|
|
||||||
const reader = new FileReader();
|
|
||||||
reader.onload = () => {
|
|
||||||
base64Output.value = reader.result;
|
|
||||||
outputGroup.style.display = 'block';
|
|
||||||
};
|
|
||||||
reader.onerror = (error) => {
|
|
||||||
alert('Error reading file: ' + error);
|
|
||||||
};
|
|
||||||
reader.readAsDataURL(file);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Copy to clipboard
|
|
||||||
copyBtn.addEventListener('click', () => {
|
|
||||||
base64Output.select();
|
|
||||||
navigator.clipboard.writeText(base64Output.value)
|
|
||||||
.then(() => {
|
|
||||||
const originalText = copyBtn.innerText;
|
|
||||||
copyBtn.innerText = 'Copied!';
|
|
||||||
setTimeout(() => copyBtn.innerText = originalText, 2000);
|
|
||||||
})
|
|
||||||
.catch(err => alert('Failed to copy text: ' + err));
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,205 +0,0 @@
|
|||||||
<html>
|
|
||||||
<head>
|
|
||||||
<title>Passgen 0.2.9</title>
|
|
||||||
<script>
|
|
||||||
var alphau = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
|
|
||||||
var alphal = "abcdefghijklmnopqrstuvwxyz";
|
|
||||||
var numbers = "0123456789";
|
|
||||||
var symbols = "`~!@#$%^&*()-=_+[]\{}|;':\",./<>?\\";
|
|
||||||
var space = " ";
|
|
||||||
var baseYear = 120000000000000000000000;
|
|
||||||
|
|
||||||
|
|
||||||
function $id(id) {
|
|
||||||
return document.getElementById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
async function copyInputToClipboard(inputId, buttonElement) {
|
|
||||||
const inputElement = document.getElementById(inputId);
|
|
||||||
if (!inputElement) return;
|
|
||||||
|
|
||||||
try {
|
|
||||||
await navigator.clipboard.writeText(inputElement.value);
|
|
||||||
} catch (err) {
|
|
||||||
inputElement.select();
|
|
||||||
document.execCommand('copy');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Temporary button label change
|
|
||||||
if (buttonElement) {
|
|
||||||
const originalText = buttonElement.innerText;
|
|
||||||
buttonElement.innerText = 'Copied!';
|
|
||||||
setTimeout(() => {
|
|
||||||
buttonElement.innerText = originalText;
|
|
||||||
}, 2000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function secureRand(min,max,len) {
|
|
||||||
var str = "";
|
|
||||||
var rand = [];
|
|
||||||
var pos = 0;
|
|
||||||
|
|
||||||
while(rand.length<len) {
|
|
||||||
var buf = new Uint8Array(512);
|
|
||||||
window.crypto.getRandomValues(buf);
|
|
||||||
for(i=0;i<buf.length;i++) {
|
|
||||||
if(buf[i] >= min && buf[i] <= max) {
|
|
||||||
rand[pos] = buf[i];
|
|
||||||
pos++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return rand.slice(0,len);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function generatepass(len,keys){
|
|
||||||
rlist='';
|
|
||||||
var srand = secureRand(0,keys.length,len);
|
|
||||||
for (i=0;i<len;i++) {
|
|
||||||
rlist+=keys.charAt(srand[i]);
|
|
||||||
}
|
|
||||||
|
|
||||||
return rlist;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function entropy(chars,len) {
|
|
||||||
return Math.round((Math.log(Math.pow(chars,len))/Math.log(2))*100)/100;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// chars = length of charset
|
|
||||||
// len = length of password
|
|
||||||
// base = total md5 tries per year
|
|
||||||
// TODO: Assumes power doubles every 18 months (Moore's law)
|
|
||||||
function yearsToCrack(chars,len,base) {
|
|
||||||
possible = Math.pow(chars,len);
|
|
||||||
return Math.round(possible/baseYear);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function generate() {
|
|
||||||
var len = $id('length').value;
|
|
||||||
var keylist = "";
|
|
||||||
if($id('alphal').checked) { keylist += alphal; }
|
|
||||||
if($id('alphau').checked) { keylist += alphau; }
|
|
||||||
if($id('symbols').checked) { keylist += symbols; }
|
|
||||||
if($id('numbers').checked) { keylist += numbers; }
|
|
||||||
if($id('space').checked) { keylist += space; }
|
|
||||||
|
|
||||||
$id('out').value = generatepass(len,keylist);
|
|
||||||
$id('entropy').innerHTML = entropy(keylist.length,len);
|
|
||||||
$id('years').innerHTML = yearsToCrack(keylist.length,len,baseYear);
|
|
||||||
}
|
|
||||||
window.onload = function(){generate();}
|
|
||||||
</script>
|
|
||||||
<style>
|
|
||||||
* {
|
|
||||||
font-family: 'Courier New', Courier, monospace;
|
|
||||||
font-weight: bold;
|
|
||||||
}
|
|
||||||
|
|
||||||
body {
|
|
||||||
background-color: #FFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
h1 {
|
|
||||||
margin-bottom: 5px;
|
|
||||||
}
|
|
||||||
|
|
||||||
a:link {
|
|
||||||
color: #000000;
|
|
||||||
}
|
|
||||||
|
|
||||||
a:hover {
|
|
||||||
text-decoration:none;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Base link styling */
|
|
||||||
.has-tooltip {
|
|
||||||
position: relative; /* Crucial for positioning the tooltip relative to the link */
|
|
||||||
text-decoration: underline;
|
|
||||||
cursor: pointer;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Tooltip container (text box) */
|
|
||||||
.has-tooltip::before {
|
|
||||||
content: attr(data-tooltip); /* Pulls text from the data-tooltip attribute */
|
|
||||||
position: absolute;
|
|
||||||
bottom: 100%; /* Positions the box above the top of the link */
|
|
||||||
left: 50%;
|
|
||||||
transform: translateX(-50%) translateY(-8px); /* Centers horizontally & lifts up slightly */
|
|
||||||
|
|
||||||
/* Visual styling */
|
|
||||||
background-color: #1e293b;
|
|
||||||
color: #ffffff;
|
|
||||||
padding: 6px 12px;
|
|
||||||
border-radius: 6px;
|
|
||||||
font-size: 0.85rem;
|
|
||||||
white-space: nowrap; /* Prevents text from wrapping */
|
|
||||||
box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
|
|
||||||
|
|
||||||
/* Hide by default */
|
|
||||||
opacity: 0;
|
|
||||||
visibility: hidden;
|
|
||||||
transition: opacity 0.2s ease, transform 0.2s ease;
|
|
||||||
pointer-events: none; /* Prevents cursor interference */
|
|
||||||
z-index: 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Tooltip arrow pointer */
|
|
||||||
.has-tooltip::after {
|
|
||||||
content: '';
|
|
||||||
position: absolute;
|
|
||||||
bottom: 100%;
|
|
||||||
left: 50%;
|
|
||||||
transform: translateX(-50%) translateY(0);
|
|
||||||
|
|
||||||
/* Creates a small downward arrow using border tricks */
|
|
||||||
border-width: 6px 6px 0 6px;
|
|
||||||
border-style: solid;
|
|
||||||
border-color: #1e293b transparent transparent transparent;
|
|
||||||
|
|
||||||
/* Hide by default */
|
|
||||||
opacity: 0;
|
|
||||||
visibility: hidden;
|
|
||||||
transition: opacity 0.2s ease, transform 0.2s ease;
|
|
||||||
pointer-events: none;
|
|
||||||
z-index: 100;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Hover State - Reveal Tooltip & Arrow */
|
|
||||||
.has-tooltip:hover::before,
|
|
||||||
.has-tooltip:hover::after {
|
|
||||||
opacity: 1;
|
|
||||||
visibility: visible;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Subtle upward slide animation on hover */
|
|
||||||
.has-tooltip:hover::before {
|
|
||||||
transform: translateX(-20%) translateY(-12px);
|
|
||||||
}
|
|
||||||
|
|
||||||
.has-tooltip:hover::after {
|
|
||||||
transform: translateX(-20%) translateY(-6px);
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
<h1>Passgen<sup><a href="javascript:alert('Passgen 0.2.9\nCryptographically secure password generator\n\nHere is how passgen protects you:\n* Uses a cryptographically secure random number generator to\ngenerate a properly random secure password\n* Nothing is ever sent to anyone! It all runs through your browser\n* Even visiting a website and loading pages from it is not needed\npassgen can run through a bookmarklet without even being online\n* Nothing is ever, ever stored or logged\n* The web page you got this from keeps no logs including IP logs or even a hit counter\n* The website you got this from is secured with TLS to ensure this bookmarklet was not tampered with in transit\n* This bookmarklet code is singed with PGP to guarantee it has not been tampered with by a hacker\n\nPrincess Pi - https://git.thecoven.info/PrincessPi');">?</a></sup></h1>
|
|
||||||
<input type="checkbox" id="alphal" onchange="generate()" checked> <label for="alphal">Lowercase Letters</label><a href="#" class="has-tooltip" data-tooltip="abcdefghijklmnopqrstuvwxyz">?</a><br>
|
|
||||||
<input type="checkbox" id="alphau" onchange="generate()" checked> <label for="alphau">Uppercase Letters</label><a href="#" class="has-tooltip" data-tooltip="ABCDEFGHIJKLMNOPQRSTUVWXYZ">?</a><br>
|
|
||||||
<input type="checkbox" id="numbers" onchange="generate()" checked> <label for="numbers">Numbers</label><a href="#" class="has-tooltip" data-tooltip="0123456789">?</a><br>
|
|
||||||
<input type="checkbox" id="symbols" onchange="generate()" checked> <label for="symbols">Symbols</label><a href="#" class="has-tooltip" data-tooltip="`~!@#$%^&*()-=_+[]\{}|;':",.<>?\">?</a><br>
|
|
||||||
<input type="checkbox" id="space" onchange="generate()" checked> <label for="space">Space</label><a href="#" class="has-tooltip" data-tooltip="Space AKA 0x20, \\s, %20, and &nbsp;">?</a><br>
|
|
||||||
<label for="length">Length</label> <input type="text" id="length" size="4" value="23" onchange="generate()"><br><br>
|
|
||||||
<button value="Generate" onclick="generate()">Generate New</button> <!--<input type="button" value="Close" onclick="window.close()">-->
|
|
||||||
<p><b>Password</b> <input type="text" id="out" size="40" readonly> <button onclick="copyInputToClipboard('out', this)">Copy</button></p>
|
|
||||||
<p><b>Strength<sup><a href="#" class="has-tooltip" data-tooltip="Bits of entropy. log2(characters^length)">?</a></sup></b> <span id="entropy"></span> bits</p>
|
|
||||||
<p><b>Years to Crack<sup><a href="#" class="has-tooltip" data-tooltip="WORK IN PROGRESS

Assumes all computing power on Earth being used collaboratively, doubling in power every 18 months.

Also assumes a weak hash, MD5. (EXCLUDES collisions in MD5)">?</a></sup></b> <span id="years"></span></p>
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
File diff suppressed because one or more lines are too long
@@ -1,280 +0,0 @@
|
|||||||
<!DOCTYPE html>
|
|
||||||
<html lang="en">
|
|
||||||
<head>
|
|
||||||
<meta charset="UTF-8">
|
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
||||||
<title>String Tools</title>
|
|
||||||
<style>
|
|
||||||
* {
|
|
||||||
box-sizing: border-box;
|
|
||||||
margin: 0;
|
|
||||||
padding: 0;
|
|
||||||
font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
|
|
||||||
}
|
|
||||||
body {
|
|
||||||
background-color: #f4f6f8;
|
|
||||||
color: #333;
|
|
||||||
display: flex;
|
|
||||||
justify-content: center;
|
|
||||||
align-items: center;
|
|
||||||
min-height: 100vh;
|
|
||||||
padding: 20px;
|
|
||||||
}
|
|
||||||
.container {
|
|
||||||
background: #ffffff;
|
|
||||||
border-radius: 12px;
|
|
||||||
box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
|
|
||||||
padding: 30px;
|
|
||||||
width: 100%;
|
|
||||||
max-width: 650px;
|
|
||||||
}
|
|
||||||
h2 {
|
|
||||||
margin-bottom: 20px;
|
|
||||||
font-size: 1.5rem;
|
|
||||||
text-align: center;
|
|
||||||
}
|
|
||||||
.input-group {
|
|
||||||
margin-bottom: 20px;
|
|
||||||
}
|
|
||||||
label {
|
|
||||||
display: block;
|
|
||||||
font-weight: 600;
|
|
||||||
font-size: 0.9rem;
|
|
||||||
margin-bottom: 6px;
|
|
||||||
}
|
|
||||||
textarea {
|
|
||||||
width: 100%;
|
|
||||||
height: 100px;
|
|
||||||
padding: 12px;
|
|
||||||
border: 1px solid #ccc;
|
|
||||||
border-radius: 6px;
|
|
||||||
font-size: 0.95rem;
|
|
||||||
resize: vertical;
|
|
||||||
background-color: #fafafa;
|
|
||||||
}
|
|
||||||
textarea:focus {
|
|
||||||
outline: none;
|
|
||||||
border-color: #0066ff;
|
|
||||||
background-color: #fff;
|
|
||||||
}
|
|
||||||
.section-header {
|
|
||||||
font-size: 0.85rem;
|
|
||||||
font-weight: 700;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.5px;
|
|
||||||
color: #0066ff;
|
|
||||||
margin: 20px 0 10px 0;
|
|
||||||
padding-bottom: 4px;
|
|
||||||
border-bottom: 2px solid #e1effe;
|
|
||||||
}
|
|
||||||
.output-card {
|
|
||||||
background-color: #f8f9fa;
|
|
||||||
border: 1px solid #e9ecef;
|
|
||||||
border-radius: 6px;
|
|
||||||
padding: 12px;
|
|
||||||
margin-bottom: 12px;
|
|
||||||
}
|
|
||||||
.output-card.hidden {
|
|
||||||
display: none;
|
|
||||||
}
|
|
||||||
.output-card.error {
|
|
||||||
border-color: #ffc9c9;
|
|
||||||
background-color: #fff5f5;
|
|
||||||
}
|
|
||||||
.output-card .title {
|
|
||||||
font-size: 0.8rem;
|
|
||||||
text-transform: uppercase;
|
|
||||||
letter-spacing: 0.5px;
|
|
||||||
color: #6c757d;
|
|
||||||
margin-bottom: 4px;
|
|
||||||
font-weight: 700;
|
|
||||||
}
|
|
||||||
.output-card .value {
|
|
||||||
font-family: monospace;
|
|
||||||
font-size: 0.95rem;
|
|
||||||
word-break: break-all;
|
|
||||||
white-space: pre-wrap;
|
|
||||||
color: #212529;
|
|
||||||
}
|
|
||||||
.value.error-text {
|
|
||||||
color: #d9534f;
|
|
||||||
font-style: italic;
|
|
||||||
}
|
|
||||||
</style>
|
|
||||||
</head>
|
|
||||||
<body>
|
|
||||||
|
|
||||||
<div class="container">
|
|
||||||
<h2>String Tools</h2>
|
|
||||||
|
|
||||||
<div class="input-group">
|
|
||||||
<label for="strInput">Enter your string below:</label>
|
|
||||||
<textarea id="strInput" placeholder="Type or paste something here..."></textarea>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="section-header">String Transformations</div>
|
|
||||||
|
|
||||||
<div class="output-card">
|
|
||||||
<div class="title">Character Count (Length)</div>
|
|
||||||
<div class="value" id="outLength">0</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="output-card">
|
|
||||||
<div class="title">Uppercase</div>
|
|
||||||
<div class="value" id="outUpper">---</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="output-card">
|
|
||||||
<div class="title">Lowercase</div>
|
|
||||||
<div class="value" id="outLower">---</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="output-card">
|
|
||||||
<div class="title">URL Encoded</div>
|
|
||||||
<div class="value" id="outEncoded">---</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="output-card" id="urlDecodedCard">
|
|
||||||
<div class="title">URL Decoded</div>
|
|
||||||
<div class="value" id="outDecoded">---</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="output-card">
|
|
||||||
<div class="title">Base64 Encoded</div>
|
|
||||||
<div class="value" id="outB64Enc">---</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="output-card hidden" id="b64DecCard">
|
|
||||||
<div class="title">Base64 Decoded</div>
|
|
||||||
<div class="value" id="outB64Dec">---</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="section-header">Hashes</div>
|
|
||||||
|
|
||||||
<div class="output-card">
|
|
||||||
<div class="title">SHA-1</div>
|
|
||||||
<div class="value" id="outSha1">---</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="output-card">
|
|
||||||
<div class="title">SHA-256</div>
|
|
||||||
<div class="value" id="outSha256">---</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="output-card">
|
|
||||||
<div class="title">SHA-512</div>
|
|
||||||
<div class="value" id="outSha512">---</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<script>
|
|
||||||
const strInput = document.getElementById('strInput');
|
|
||||||
const outLength = document.getElementById('outLength');
|
|
||||||
const outUpper = document.getElementById('outUpper');
|
|
||||||
const outLower = document.getElementById('outLower');
|
|
||||||
const outEncoded = document.getElementById('outEncoded');
|
|
||||||
const outDecoded = document.getElementById('outDecoded');
|
|
||||||
const urlDecodedCard = document.getElementById('urlDecodedCard');
|
|
||||||
|
|
||||||
const outB64Enc = document.getElementById('outB64Enc');
|
|
||||||
const outB64Dec = document.getElementById('outB64Dec');
|
|
||||||
const b64DecCard = document.getElementById('b64DecCard');
|
|
||||||
|
|
||||||
const outSha1 = document.getElementById('outSha1');
|
|
||||||
const outSha256 = document.getElementById('outSha256');
|
|
||||||
const outSha512 = document.getElementById('outSha512');
|
|
||||||
|
|
||||||
// Safe Unicode Base64 Helper
|
|
||||||
function utf8ToBase64(str) {
|
|
||||||
return btoa(encodeURIComponent(str).replace(/%([0-9A-F]{2})/g, (match, p1) => {
|
|
||||||
return String.fromCharCode('0x' + p1);
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
|
|
||||||
function base64ToUtf8(str) {
|
|
||||||
return decodeURIComponent(atob(str).split('').map((c) => {
|
|
||||||
return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2);
|
|
||||||
}).join(''));
|
|
||||||
}
|
|
||||||
|
|
||||||
// Helper function to calculate Web Crypto hashes
|
|
||||||
async function computeHash(algo, text) {
|
|
||||||
if (!text) return '---';
|
|
||||||
const msgUint8 = new TextEncoder().encode(text);
|
|
||||||
const hashBuffer = await crypto.subtle.digest(algo, msgUint8);
|
|
||||||
const hashArray = Array.from(new Uint8Array(hashBuffer));
|
|
||||||
return hashArray.map(b => b.toString(16).padStart(2, '0')).join('');
|
|
||||||
}
|
|
||||||
|
|
||||||
strInput.addEventListener('input', async () => {
|
|
||||||
const val = strInput.value;
|
|
||||||
|
|
||||||
if (val.length === 0) {
|
|
||||||
outLength.textContent = '0';
|
|
||||||
outUpper.textContent = '---';
|
|
||||||
outLower.textContent = '---';
|
|
||||||
outEncoded.textContent = '---';
|
|
||||||
outDecoded.textContent = '---';
|
|
||||||
outB64Enc.textContent = '---';
|
|
||||||
outB64Dec.textContent = '---';
|
|
||||||
outSha1.textContent = '---';
|
|
||||||
outSha256.textContent = '---';
|
|
||||||
outSha512.textContent = '---';
|
|
||||||
|
|
||||||
urlDecodedCard.classList.remove('error');
|
|
||||||
b64DecCard.classList.add('hidden');
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Basic Transformations
|
|
||||||
outLength.textContent = val.length;
|
|
||||||
outUpper.textContent = val.toUpperCase();
|
|
||||||
outLower.textContent = val.toLowerCase();
|
|
||||||
outEncoded.textContent = encodeURIComponent(val);
|
|
||||||
|
|
||||||
// URL Decoded
|
|
||||||
try {
|
|
||||||
outDecoded.textContent = decodeURIComponent(val);
|
|
||||||
outDecoded.classList.remove('error-text');
|
|
||||||
urlDecodedCard.classList.remove('error');
|
|
||||||
} catch (e) {
|
|
||||||
outDecoded.textContent = "Error: Invalid URL encoding sequence";
|
|
||||||
outDecoded.classList.add('error-text');
|
|
||||||
urlDecodedCard.classList.add('error');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Base64 Encoded
|
|
||||||
outB64Enc.textContent = utf8ToBase64(val);
|
|
||||||
|
|
||||||
// Base64 Decoded (Hidden unless input is valid Base64)
|
|
||||||
const trimmedVal = val.trim();
|
|
||||||
// Regex validates Base64 formatting before attempting decoding
|
|
||||||
const isB64Format = /^[A-Za-z0-9+/=]+$/.test(trimmedVal) && (trimmedVal.length % 4 === 0);
|
|
||||||
|
|
||||||
if (isB64Format) {
|
|
||||||
try {
|
|
||||||
const decoded = base64ToUtf8(trimmedVal);
|
|
||||||
outB64Dec.textContent = decoded;
|
|
||||||
b64DecCard.classList.remove('hidden');
|
|
||||||
} catch (e) {
|
|
||||||
b64DecCard.classList.add('hidden');
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
b64DecCard.classList.add('hidden');
|
|
||||||
}
|
|
||||||
|
|
||||||
// Calculate Cryptographic Hashes asynchronously
|
|
||||||
try {
|
|
||||||
outSha1.textContent = await computeHash('SHA-1', val);
|
|
||||||
outSha256.textContent = await computeHash('SHA-256', val);
|
|
||||||
outSha512.textContent = await computeHash('SHA-512', val);
|
|
||||||
} catch (e) {
|
|
||||||
outSha1.textContent = "Error computing hash";
|
|
||||||
outSha256.textContent = "Error computing hash";
|
|
||||||
outSha512.textContent = "Error computing hash";
|
|
||||||
}
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
|
|
||||||
</body>
|
|
||||||
</html>
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
# Windows-Repair.ps1 Usage:
|
|
||||||
1. Open PowerShell terminal
|
|
||||||
```powershell
|
|
||||||
iwr -UseBasicParsing -Uri "https://git.thecoven.info/PrincessPi/general-scripts-and-system-ssssssetup/raw/branch/main/Windows-Scripts/windows-repair.ps1?nocache=$(Get-Random)" -OutFile "$env:TEMP\windows-repair3.ps1"; &"$env:TEMP\windows-repair3.ps1"
|
|
||||||
```
|
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
while($True) {
|
|
||||||
nmap -p22 -sV --open 10.0.0.0/24 -oG -
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
# usage:
|
|
||||||
## All paramaters are optional
|
|
||||||
## All paramaters are compatible with each other
|
|
||||||
## Default behavior is to restart immediately after zero time
|
|
||||||
## IM_SO_TIRED_BOSS -Seconds <int seconds> -Minutes <int minutes> -Hours <int hours> -ChkDsk $True
|
|
||||||
## Examples:
|
|
||||||
### IM_SO_TIRED_BOSS -Minutes 90
|
|
||||||
### IM_SO_TIRED_BOSS -Minutes 30 -Hours 1
|
|
||||||
### IM_SO_TIRED_BOSS -Minutes 30 -ChkDsk $True
|
|
||||||
|
|
||||||
Param(
|
|
||||||
[int]$Seconds = 0,
|
|
||||||
[int]$Minutes = 0,
|
|
||||||
[int]$Hours = 0,
|
|
||||||
[bool]$ChkDsk = $false
|
|
||||||
)
|
|
||||||
|
|
||||||
# Force off for longer by doing offline modern chkdsk to tie up your computer to be unusable for a while
|
|
||||||
# pipes y to it so its noninteractive
|
|
||||||
# auto elevates to admin when run with -ChkDsk $True
|
|
||||||
if ($ChkDsk) {
|
|
||||||
# elevate to admin
|
|
||||||
# set for offline chkdsk noninteractively by piping y to it lmao
|
|
||||||
# runs a cmd window as admin running "echo y | chkdsk C: /f /r" which then closes
|
|
||||||
Start-Process cmd.exe -Verb RunAs -ArgumentList "/c echo y | chkdsk C: /f /r"
|
|
||||||
}
|
|
||||||
|
|
||||||
# Current date object
|
|
||||||
$CurrentTime = Get-Date
|
|
||||||
|
|
||||||
# the .AddX() are in sequence to get the date object plus seconds, minutes, and hours
|
|
||||||
$RebootTime = $CurrentTime.AddSeconds($Seconds).AddMinutes($Minutes).AddHours($Hours).ToString("dddd hh:mm:ss tt")
|
|
||||||
|
|
||||||
# Calculate the number of seconds in total selected time
|
|
||||||
$WaitDuration = New-TimeSpan -Seconds $Seconds -Minutes $Minutes -Hours $Hours
|
|
||||||
$WaitSeconds = $WaitDuration.TotalSeconds
|
|
||||||
|
|
||||||
# Print to terminal too for nicess
|
|
||||||
Write-Host "`nREBOOTING AT $RebootTime`n"
|
|
||||||
|
|
||||||
# Start-Job to fork the script block to background so it can proceed with the timer/shutdown even if no interaction with alert box
|
|
||||||
Start-Job -ScriptBlock {
|
|
||||||
# the $using: method lets me adjusst the scope of $RebootTime and get it in this script block
|
|
||||||
$RebootTime = $using:RebootTime
|
|
||||||
|
|
||||||
# add the presentation framework in
|
|
||||||
Add-Type -AssemblyName PresentationFramework
|
|
||||||
|
|
||||||
# Show an Error/Stop alert box with just an OK button and the message
|
|
||||||
[System.Windows.MessageBox]::Show("REBOOTING AT $RebootTime", "FORCE REBOOTING MINUTES AT $RebootTime", 'OK', 'Error')
|
|
||||||
}
|
|
||||||
|
|
||||||
# do the wait
|
|
||||||
Start-Sleep -Seconds $WaitSeconds
|
|
||||||
|
|
||||||
# Add-Type -AssemblyName PresentationFramework
|
|
||||||
# [System.Windows.MessageBox]::Show("PING WORKING", "$RebootTime", 'OK', 'Error')
|
|
||||||
|
|
||||||
# x Force reboot with no warning
|
|
||||||
# Disabled -Force to let apps close gracefully
|
|
||||||
Stop-Computer # -Force
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
donkeydicks:pope:
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
# Usage: alert <message="Alert"> (<type=Information/None/Error/Question/Warning> (<Buttons=OK/OKCancel/YesNoCancel/YesNo>))
|
|
||||||
|
|
||||||
# HELP HANDLE
|
|
||||||
if($args[0] -eq 'h' -or $args[0] -eq '-h' -or $args[0] -eq 'H' -or $args[0] -eq '-H' -or $args[0] -eq 'help' -or $args[0] -eq 'Help' -or $args[0] -eq 'HELP') {
|
|
||||||
Write-Host "Usage: alert <message=Alert> (<type=Information/None/Error/Question/Warning> (<Buttons=OK/OKCancel/YesNoCancel/YesNo>))`nalert h/-h/help/etc: Display this help message"
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
|
|
||||||
# MESSAGE HANDLE DEFAULT
|
|
||||||
if([string]::IsNullOrEmpty($args[0])) {
|
|
||||||
$Message = "Alert"
|
|
||||||
} else {
|
|
||||||
$Message = $args[0]
|
|
||||||
}
|
|
||||||
|
|
||||||
# TYPE HANDLE DEFAULT
|
|
||||||
if([string]::IsNullOrEmpty($args[1])) {
|
|
||||||
$Type = "Information"
|
|
||||||
} else {
|
|
||||||
$Type = $args[1]
|
|
||||||
}
|
|
||||||
|
|
||||||
# BUTTONS HANDLE DEFAULT
|
|
||||||
if([string]::IsNullOrEmpty($args[2])) {
|
|
||||||
$Buttons = "OK"
|
|
||||||
} else {
|
|
||||||
$Buttons = $args[2]
|
|
||||||
}
|
|
||||||
|
|
||||||
# doin inide start-job method so alert box doesnt block
|
|
||||||
Start-Job -ScriptBlock {
|
|
||||||
# get back my fuckin vars inside this script block
|
|
||||||
$Message = $using:Message
|
|
||||||
$Buttons = $using:Buttons
|
|
||||||
$Type = $using:Type
|
|
||||||
|
|
||||||
# Add the PresentationFramework
|
|
||||||
Add-Type -AssemblyName PresentationFramework
|
|
||||||
|
|
||||||
# Send the alert
|
|
||||||
[System.Windows.MessageBox]::Show($Message, $Message, $Buttons, $Type)
|
|
||||||
};
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
1. recursive verify error: `FAILED open or read` RIGHT NOW GENERATES RELATIVE PATH/FILENAME IN CHECKSUMS FILES IN SUBDIRS, SHOULD JUST BE FOR THE FILES IN DAT DIR (for linux compatability)
|
|
||||||
2. recursive progress set to count total number of files recursively first for progress bar.
|
|
||||||
3. paralell processing
|
|
||||||
4. Princess Pi ascii art magenta
|
|
||||||
5. princess pi bubble text ascii art blue
|
|
||||||
6. script for full top-to-bottom testing
|
|
||||||
7. BASH linux version
|
|
||||||
8. more hashing algos?
|
|
||||||
9. multi-algo paralell workin? like multiple -a params?
|
|
||||||
@@ -1,656 +0,0 @@
|
|||||||
<#
|
|
||||||
.SYNOPSIS
|
|
||||||
Princess Pi's Magical CHECKSUM! - Computes and verifies message digests / file checksums.
|
|
||||||
.DESCRIPTION
|
|
||||||
Computes or verifies checksums using cryptographic hash algorithms (SHA256, SHA512, SHA1, MD5, SHA384).
|
|
||||||
Supports parallel processing, recursive scanning, direct hash matching, and verification file parsing.
|
|
||||||
.NOTES
|
|
||||||
Requires PowerShell 7.0 or higher.
|
|
||||||
#>
|
|
||||||
|
|
||||||
[CmdletBinding(DefaultParameterSetName='Generate')]
|
|
||||||
param(
|
|
||||||
# File(s) or wildcard pattern to compute checksum for
|
|
||||||
[Parameter(Position = 0, ParameterSetName = 'Generate', ValueFromPipeline = $true)]
|
|
||||||
[Parameter(Position = 0, ParameterSetName = 'Match', ValueFromPipeline = $true)]
|
|
||||||
[Parameter(Position = 0, ParameterSetName = 'PrincessPi', ValueFromPipeline = $false)]
|
|
||||||
[Alias('i', 'input', 'if', 'InputFile')]
|
|
||||||
[string[]]$FilePath,
|
|
||||||
|
|
||||||
# Custom output file (-f / -OutFile / -of)
|
|
||||||
[Parameter(Mandatory = $false, ParameterSetName = 'Generate')]
|
|
||||||
[Alias('f', 'of')]
|
|
||||||
[string]$OutFile,
|
|
||||||
|
|
||||||
# Auto output file switch (-s / -Save / -o)
|
|
||||||
[Parameter(Mandatory = $false, ParameterSetName = 'Generate')]
|
|
||||||
[Alias('s', 'o')]
|
|
||||||
[switch]$Save,
|
|
||||||
|
|
||||||
# File containing checksums to verify (-c / -Check)
|
|
||||||
[Parameter(Mandatory = $false, ParameterSetName = 'Verify')]
|
|
||||||
[Alias('c')]
|
|
||||||
[string]$Check,
|
|
||||||
|
|
||||||
# Direct checksum hash string to match against (-m / -Match)
|
|
||||||
[Parameter(Mandatory = $true, ParameterSetName = 'Match')]
|
|
||||||
[Alias('m')]
|
|
||||||
[string]$Match,
|
|
||||||
|
|
||||||
# Hashing algorithm to use (Defaults to SHA256)
|
|
||||||
[Parameter(Mandatory = $false)]
|
|
||||||
[Alias('a', 'algo')]
|
|
||||||
[ValidateSet('SHA1', 'SHA256', 'SHA384', 'SHA512', 'MD5')]
|
|
||||||
[string]$Algorithm,
|
|
||||||
|
|
||||||
# Recursive flag (-r / -Recursive)
|
|
||||||
[Parameter(Mandatory = $false)]
|
|
||||||
[Alias('r')]
|
|
||||||
[switch]$Recursive,
|
|
||||||
|
|
||||||
# Princess Pi art flag (-pp / -PrincessPi)
|
|
||||||
[Parameter(Mandatory = $true, ParameterSetName = 'PrincessPi')]
|
|
||||||
[Alias('pp')]
|
|
||||||
[switch]$PrincessPi,
|
|
||||||
|
|
||||||
# Help flag (-h / -Help)
|
|
||||||
[Parameter(Mandatory = $false)]
|
|
||||||
[Alias('h')]
|
|
||||||
[switch]$Help
|
|
||||||
)
|
|
||||||
|
|
||||||
# --- ENVIRONMENT SANITY CHECK ---
|
|
||||||
if ($PSVersionTable.PSVersion.Major -lt 7) {
|
|
||||||
Write-Error "checksum: This script requires PowerShell 7 or higher for parallel execution (-Parallel support). Current version is $($PSVersionTable.PSVersion)."
|
|
||||||
exit 1
|
|
||||||
}
|
|
||||||
|
|
||||||
# --- HELPER FUNCTIONS ---
|
|
||||||
function Show-Help {
|
|
||||||
@'
|
|
||||||
|
|
||||||
Princess Pi's Magical CHECKSUM!
|
|
||||||
|
|
||||||
NAME
|
|
||||||
checksum - Compute and verify message digests / file checksums
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
.\checksum.ps1 [-FilePath] <string[]> [-s] [-f <string>] [-Algorithm <string>] [-r]
|
|
||||||
.\checksum.ps1 [-FilePath] <string[]> -Match <string> [-Algorithm <string>] [-r]
|
|
||||||
.\checksum.ps1 -Check <string> [-Algorithm <string>] [-r]
|
|
||||||
.\checksum.ps1 -PrincessPi
|
|
||||||
.\checksum.ps1 -Help
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
Computes or verifies checksums using cryptographic hash algorithms (SHA256, SHA512, SHA1, MD5, SHA384).
|
|
||||||
Outputs hash values in standard GNU coreutils format (<hash> <filename>).
|
|
||||||
Ignores checksum metadata files (.md5, .sha1, .sha256, .sha384, .sha512) during wildcards unless passed explicitly.
|
|
||||||
|
|
||||||
PARAMETERS
|
|
||||||
-FilePath, -i, -input, -if, -InputFile <string[]>
|
|
||||||
Specifies the target file(s) or wildcard pattern (*).
|
|
||||||
|
|
||||||
-s, -S, -Save, -o, -O <switch>
|
|
||||||
Auto-saves checksum results. (Takes no arguments).
|
|
||||||
- If input filename contains a wildcard (*), saves to 'checksums.<algo>'.
|
|
||||||
- If input filename does NOT contain a wildcard, saves to '<filename>.<algo>'.
|
|
||||||
When combined with -r and *, recursively auto-generates checksums per directory.
|
|
||||||
|
|
||||||
-f, -F, -of, -OF, -OutFile <string>
|
|
||||||
Saves checksum results to a specific custom filename.
|
|
||||||
Overrides the auto-naming behavior of -s if both are passed.
|
|
||||||
|
|
||||||
-c, -C, -Check <string>
|
|
||||||
Reads hashes from a specified checksum file and verifies target files on disk.
|
|
||||||
If -r is specified, recursively looks for and validates checksum files by name across subdirectories.
|
|
||||||
|
|
||||||
-m, -M, -Match <string>
|
|
||||||
Compares the computed hash of target file(s) directly against a given hash string.
|
|
||||||
|
|
||||||
-a, -A, -Algo, -Algorithm <string>
|
|
||||||
Specifies the hash algorithm to use.
|
|
||||||
Supported options: MD5, SHA1, SHA256 (default), SHA384, SHA512.
|
|
||||||
In -c or -m mode, auto-detects algorithm from hash length if omitted.
|
|
||||||
|
|
||||||
-r, -R, -Recursive <switch>
|
|
||||||
Processes target files or verification files recursively across directory structures.
|
|
||||||
|
|
||||||
-pp, -PP, -PrincessPi <switch>
|
|
||||||
Displays Princess Pi!
|
|
||||||
|
|
||||||
-h, -H, -Help <switch>
|
|
||||||
Displays this help documentation.
|
|
||||||
Also displays on any error.
|
|
||||||
|
|
||||||
EXAMPLES
|
|
||||||
1. Compute SHA256 for a single file and auto-save as 'myfile.iso.sha256':
|
|
||||||
.\checksum.ps1 myfile.iso -s
|
|
||||||
|
|
||||||
2. Compute SHA512 recursively and auto-save as 'checksums.sha512' in each folder:
|
|
||||||
.\checksum.ps1 * -r -s -a SHA512
|
|
||||||
|
|
||||||
3. Compute SHA256 checksums and save to a specific custom file:
|
|
||||||
.\checksum.ps1 * -f my_hashes.txt
|
|
||||||
|
|
||||||
4. Verify checksums against a verification file:
|
|
||||||
.\checksum.ps1 -c checksums.sha256
|
|
||||||
|
|
||||||
5. Compare file directly against an expected hash string:
|
|
||||||
.\checksum.ps1 myfile.bin -m 406653a68bd3538975656831f33f031b
|
|
||||||
|
|
||||||
Princess Pi LOVES YOU!~
|
|
||||||
https://linktr.ee/princesspi3
|
|
||||||
|
|
||||||
'@
|
|
||||||
}
|
|
||||||
|
|
||||||
function Write-ErrorWithHelp {
|
|
||||||
param([string]$ErrorMessage);
|
|
||||||
Show-Help;
|
|
||||||
Write-Host "";
|
|
||||||
Write-Error $ErrorMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
function Show-PrincessPiArt {
|
|
||||||
$art = @'
|
|
||||||
|
|
||||||
=#= -- ##*+++++ *+
|
|
||||||
-#=#- +# -*%%= ##++++++++++# ##*********#
|
|
||||||
#==#= *** %%++%% -++# #++++++++++++*+ *#***************#
|
|
||||||
#===#= %***+%++#*%%@+++++% #++++++++++++**+++#******++********#
|
|
||||||
====+#%@*******###%=%++##++% #+++++++++++*++++++++#***====+****++#
|
|
||||||
=#=*==**#*#########%++#*+++@ *++++++++#+++++++++++#****==+******#
|
|
||||||
*#=====%####***%%++++#*+++**% ++++++++*+++++++++++++#************#*******
|
|
||||||
@****#==%####**#*+++++++#+++#**# #+++++++++++++++++++#####+*****************#
|
|
||||||
@****#######%**@+*%**#%+++++%##*** #+++++++++++++++++#+++++#****+======*****+
|
|
||||||
#****##%####@**%+*******@@+++@###**% #+++++++++++++*++++++++++****========****#
|
|
||||||
****#####%%*%*%+***@@@%%@*+++@####** *+++++++++++++++++++++#****=======****#
|
|
||||||
%***####%%**+%%*++*@=##@@%@++++%###*** ++++*+++++++++++#+**************#
|
|
||||||
@%%%@@##%%#++++++++==**@@**+++%*###**% +++++++++++#*+++++#*********####
|
|
||||||
%###%++++++++====**#++++%**##**% @% ++++#+++++++++++++**************#
|
|
||||||
%###%++++++++++++++++++%**%##**%@###@ %++++++++++++++++***=====********
|
|
||||||
###%%++++++++%++++++*%%%%###***##%##@ +++++++++++++##**************#
|
|
||||||
###%%%%+++++##+++++++#*+%###***%%%##@ ++++++++++++++%********+############%@
|
|
||||||
@%%*@*%%%%###****+*%%****++%##***%##@@@ #+++++++++++++++*********###*****#########*
|
|
||||||
#%%###***#####%**++++##**%#@@#@ ##+++++++++*###%#+***+***##*************#######
|
|
||||||
@#%%####%%####%+++++++##*######%++++++++++++++#*+++++#%###%#######*********######%
|
|
||||||
##%########@%@+++@###%*%#####@+++++++++++%**++++++++++%%%%%%########***==**###%##%
|
|
||||||
%#%###%###########@@%#%#@@##++++++++****++++********+++ %########**===*###%*#
|
|
||||||
#**##%####@@####%@######%*++++++++++++++++#++**+*#++++# ########******###% %
|
|
||||||
@#***# ###%@@##%#######@+++++++++++++++++++++%*++**++++# *########******##% @
|
|
||||||
*******% %##% =@#########++++++++++++++++++#++++*%++*#%#++# ########******##%
|
|
||||||
#@%@# %% *@#@@###*+++++++++++++++++++%+++##+++###++* ##*#####******##@
|
|
||||||
**##%*++%++++++++++++++++++++++++++++++++% +#**#####******###
|
|
||||||
##%#######*@***+#+++++++++++++++#***#++++++++++++ %**#####*******#%
|
|
||||||
*+++++$****##****++++++++##% #******#+++++++++++ %**#####*******#@
|
|
||||||
#++++++++*******- ++++++++# *******#++++++++++# @**#####*******#
|
|
||||||
#@@+++++++******- *+++++++# #******#+++++++++* **####%**==+**@
|
|
||||||
@@@@@+++ %+++++++# ******# %+++++++ %*###%***===**@ %=
|
|
||||||
@@@@@@@@@ #+++++++# =****** #++++++% *###%#***=+**% %**
|
|
||||||
@@@@@@@@@@ ++++++++# ******# #++++++# *##@%********% @*@
|
|
||||||
@@+@@@++@@+ ++++++++# ******# #++++++# @## #*********@ #***#
|
|
||||||
@@+@@++@@@++ @@@++++++* @@@%**** #@@++++% +## %#****************%
|
|
||||||
@*@**@+++# @@@@+++++ @@@@@@**# @@@@@++++# @# %#****************
|
|
||||||
+#+++++# @@@@@@+++% @@@@@@@@# @@@@@@@++ @ %##************%
|
|
||||||
#+++** @@@@@@@@@@ @@@@@@@@@ @@@@@@@@@ %###********%*
|
|
||||||
@@@@@@@@@@+ @@@@@@@@@@ =@@@@@@@@@ %%#####%%
|
|
||||||
*@@@@@@@@@@ @+*@@@@@@@= @@++@@@@@@
|
|
||||||
@++@@@@@@@@ #**@**@@@@@ *@@*#@@@@@@ -=
|
|
||||||
@%#@@@@@@@@ *#***@@@@@@ @+#+@++#@@@
|
|
||||||
#+++@++@@@@@ **********# #+++++@+@@@@
|
|
||||||
##+#+++@@@@@@ ##****#### *+#+##+++@@%%
|
|
||||||
#+++++++++++# #++++++++++#
|
|
||||||
#########*
|
|
||||||
|
|
||||||
____ ____ ____ _ _ ___ ____ ___ ___ ____ ____
|
|
||||||
( _ \( _ \(_ _)( \( )/ __)( ___)/ __)/ __) ( _ \(_ _)/\/
|
|
||||||
)___/ ) / _)(_ ) (( (__ )__) \__ \\__ \ )___/ _)(_
|
|
||||||
(__) (_)\_)(____)(_)\_)\___)(____)(___/(___/ (__) (____)
|
|
||||||
|
|
||||||
Princess Pi
|
|
||||||
https://linktr.ee/princesspi3
|
|
||||||
|
|
||||||
'@
|
|
||||||
Write-Host $art -ForegroundColor Blue;
|
|
||||||
}
|
|
||||||
|
|
||||||
function Get-AlgorithmFromHashLength {
|
|
||||||
param([string]$HashString);
|
|
||||||
|
|
||||||
switch ($HashString.Trim().Length) {
|
|
||||||
32 { return 'MD5'; }
|
|
||||||
40 { return 'SHA1'; }
|
|
||||||
64 { return 'SHA256'; }
|
|
||||||
96 { return 'SHA384'; }
|
|
||||||
128 { return 'SHA512'; }
|
|
||||||
default {
|
|
||||||
Write-ErrorWithHelp "checksum: Could not auto-detect algorithm for hash length $($HashString.Length). Please specify -Algorithm.";
|
|
||||||
return $null;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# --- MAIN EXECUTION FLOW ---
|
|
||||||
$helpInPath = $false;
|
|
||||||
if ($FilePath) {
|
|
||||||
foreach ($p in ($FilePath)) {
|
|
||||||
if ($p -match '^(?i)[-/]{1,2}(h|help|\?)$') {
|
|
||||||
$helpInPath = $true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($Help.IsPresent -or $helpInPath) {
|
|
||||||
Show-Help;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($PrincessPi.IsPresent) {
|
|
||||||
Show-PrincessPiArt;
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-not [string]::IsNullOrWhiteSpace($Algorithm)) {
|
|
||||||
$Algorithm = $Algorithm.ToUpper();
|
|
||||||
}
|
|
||||||
|
|
||||||
$isWildcardGlobal = $false;
|
|
||||||
if ($FilePath) {
|
|
||||||
foreach ($p in $FilePath) {
|
|
||||||
if ($p -match '\*') { $isWildcardGlobal = $true; }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$showProgress = $Recursive.IsPresent -or $isWildcardGlobal -or ($PSCmdlet.ParameterSetName -eq 'Verify');
|
|
||||||
|
|
||||||
# --- ITEM GATHERING (Generate & Match Modes) ---
|
|
||||||
if ($PSCmdlet.ParameterSetName -in @('Generate', 'Match')) {
|
|
||||||
if (-not $FilePath -or $FilePath.Count -eq 0) {
|
|
||||||
Write-ErrorWithHelp "checksum: Missing file path parameter. Use -Help for usage.";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
$allItems = @();
|
|
||||||
$skipExtensions = @('.md5', '.sha1', '.sha256', '.sha384', '.sha512');
|
|
||||||
|
|
||||||
foreach ($pathEntry in ($FilePath)) {
|
|
||||||
$isWildcard = ($pathEntry -match '\*');
|
|
||||||
$resolvedItems = @();
|
|
||||||
|
|
||||||
if ($Recursive) {
|
|
||||||
$resolvedItems = Get-ChildItem -Path ($pathEntry) -Recurse -File -ErrorAction 'SilentlyContinue';
|
|
||||||
} else {
|
|
||||||
if ($isWildcard -or ($pathEntry -match '\?')) {
|
|
||||||
$resolvedItems = Get-ChildItem -Path ($pathEntry) -File -ErrorAction 'SilentlyContinue';
|
|
||||||
} else {
|
|
||||||
$resolvedItems = Get-Item -Path ($pathEntry) -ErrorAction 'SilentlyContinue';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-not $resolvedItems) {
|
|
||||||
Write-ErrorWithHelp "checksum: $($pathEntry): No such file or directory";
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$explicitFileFound = $false;
|
|
||||||
if ((-not $isWildcard) -and (Test-Path -Path ($pathEntry) -PathType 'Leaf')) {
|
|
||||||
$explicitFileFound = $true;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($item in ($resolvedItems)) {
|
|
||||||
if ($item.PSIsContainer) { continue; }
|
|
||||||
|
|
||||||
if (-not $explicitFileFound) {
|
|
||||||
if ($skipExtensions -contains $item.Extension.ToLower()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
$allItems += $item;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# --- DIRECT MATCH MODE (-m / -Match) ---
|
|
||||||
if ($PSCmdlet.ParameterSetName -eq 'Match') {
|
|
||||||
if ([string]::IsNullOrWhiteSpace($Algorithm)) {
|
|
||||||
$Algorithm = Get-AlgorithmFromHashLength -HashString ($Match);
|
|
||||||
if (-not $Algorithm) { return; }
|
|
||||||
}
|
|
||||||
|
|
||||||
$expectedHash = $Match.Trim().ToLower();
|
|
||||||
$totalFiles = $allItems.Count;
|
|
||||||
$currentIndex = 0;
|
|
||||||
|
|
||||||
$allItems | ForEach-Object -Parallel {
|
|
||||||
$item = $_
|
|
||||||
$algo = $using:Algorithm
|
|
||||||
$exp = $using:expectedHash
|
|
||||||
|
|
||||||
$actualHash = (Get-FileHash -Path ($item.FullName) -Algorithm ($algo)).Hash.ToLower();
|
|
||||||
$targetFile = Resolve-Path -Path ($item.FullName) -Relative -ErrorAction 'SilentlyContinue';
|
|
||||||
if (-not $targetFile) { $targetFile = $item.Name; }
|
|
||||||
if ($targetFile.StartsWith(".\") -or $targetFile.StartsWith("./")) { $targetFile = $targetFile.Substring(2); }
|
|
||||||
|
|
||||||
[PSCustomObject]@{
|
|
||||||
TargetFile = $targetFile
|
|
||||||
IsMatch = ($actualHash -eq $exp)
|
|
||||||
}
|
|
||||||
} -ThrottleLimit 16 | ForEach-Object {
|
|
||||||
$currentIndex++
|
|
||||||
if ($showProgress -and $totalFiles -gt 0) {
|
|
||||||
Write-Progress -Activity "Matching Checksums ($Algorithm)" -Status "Processing file $currentIndex of $totalFiles" -PercentComplete (($currentIndex / $totalFiles) * 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($_.IsMatch) {
|
|
||||||
Write-Host "$($_.TargetFile): " -NoNewline;
|
|
||||||
Write-Host "OK" -ForegroundColor Green;
|
|
||||||
} else {
|
|
||||||
Write-Host "$($_.TargetFile): " -NoNewline;
|
|
||||||
Write-Host "FAILED" -ForegroundColor Red;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($showProgress) {
|
|
||||||
Write-Progress -Activity "Matching Checksums ($Algorithm)" -Completed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
# --- VERIFICATION MODE (-c / -Check) ---
|
|
||||||
elseif ($PSCmdlet.ParameterSetName -eq 'Verify') {
|
|
||||||
$checkFiles = @();
|
|
||||||
if ($Recursive) {
|
|
||||||
$checkFileName = Split-Path -Path ($Check) -Leaf;
|
|
||||||
$checkFiles = Get-ChildItem -Path '.\' -Filter ($checkFileName) -Recurse -File -ErrorAction 'SilentlyContinue';
|
|
||||||
} else {
|
|
||||||
if (Test-Path -Path ($Check) -PathType 'Leaf') {
|
|
||||||
$checkFiles = @(Get-Item -Path ($Check));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (-not $checkFiles -or $checkFiles.Count -eq 0) {
|
|
||||||
Write-ErrorWithHelp "checksum: $($Check): No such file or directory";
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
foreach ($cf in ($checkFiles)) {
|
|
||||||
$lines = Get-Content -Path ($cf.FullName);
|
|
||||||
$baseDir = $cf.DirectoryName;
|
|
||||||
|
|
||||||
$fileAlgo = $Algorithm;
|
|
||||||
if ([string]::IsNullOrWhiteSpace($fileAlgo)) {
|
|
||||||
foreach ($line in ($lines)) {
|
|
||||||
if ([string]::IsNullOrWhiteSpace($line) -or $line.StartsWith("#")) { continue; }
|
|
||||||
|
|
||||||
if ($line -match '^([a-fA-F0-9]+)\s+') {
|
|
||||||
$fileAlgo = Get-AlgorithmFromHashLength -HashString ($Matches[1]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
elseif ($line -match '^([a-fA-F0-9]{128}|[a-fA-F0-9]{96}|[a-fA-F0-9]{64}|[a-fA-F0-9]{40}|[a-fA-F0-9]{32})') {
|
|
||||||
$fileAlgo = Get-AlgorithmFromHashLength -HashString ($Matches[1]);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ([string]::IsNullOrWhiteSpace($fileAlgo)) { $fileAlgo = 'SHA256'; }
|
|
||||||
}
|
|
||||||
|
|
||||||
$verifyItems = @();
|
|
||||||
foreach ($line in ($lines)) {
|
|
||||||
if ([string]::IsNullOrWhiteSpace($line) -or $line.StartsWith("#")) { continue; }
|
|
||||||
|
|
||||||
$expectedHash = $null;
|
|
||||||
$targetFile = $null;
|
|
||||||
|
|
||||||
if ($line -match '^([a-fA-F0-9]+)\s+[* ]?(.*)$') {
|
|
||||||
$expectedHash = $Matches[1].ToLower();
|
|
||||||
$targetFile = $Matches[2].Trim().TrimStart('*');
|
|
||||||
}
|
|
||||||
elseif ($line -match '^([a-fA-F0-9]{128}|[a-fA-F0-9]{96}|[a-fA-F0-9]{64}|[a-fA-F0-9]{40}|[a-fA-F0-9]{32})[* ]?(.*)$') {
|
|
||||||
$expectedHash = $Matches[1].ToLower();
|
|
||||||
$targetFile = $Matches[2].Trim().TrimStart('*');
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($expectedHash -and $targetFile) {
|
|
||||||
$targetFullPath = Join-Path -Path ($baseDir) -ChildPath ($targetFile);
|
|
||||||
$verifyItems += [PSCustomObject]@{
|
|
||||||
ExpectedHash = $expectedHash
|
|
||||||
TargetFile = $targetFile
|
|
||||||
TargetFullPath = $targetFullPath
|
|
||||||
BaseDir = $baseDir
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$totalFiles = $verifyItems.Count;
|
|
||||||
$currentIndex = 0;
|
|
||||||
|
|
||||||
$verifyItems | ForEach-Object -Parallel {
|
|
||||||
$item = $_
|
|
||||||
$algo = $using:fileAlgo
|
|
||||||
|
|
||||||
if (Test-Path -Path ($item.TargetFullPath) -PathType 'Leaf') {
|
|
||||||
$actualHash = (Get-FileHash -Path ($item.TargetFullPath) -Algorithm ($algo)).Hash.ToLower();
|
|
||||||
|
|
||||||
$displayPath = Resolve-Path -Path ($item.TargetFullPath) -Relative -ErrorAction 'SilentlyContinue';
|
|
||||||
if (-not $displayPath) { $displayPath = $item.TargetFile; }
|
|
||||||
if ($displayPath.StartsWith(".\") -or $displayPath.StartsWith("./")) { $displayPath = $displayPath.Substring(2); }
|
|
||||||
|
|
||||||
[PSCustomObject]@{
|
|
||||||
DisplayPath = $displayPath
|
|
||||||
Status = if ($actualHash -eq $item.ExpectedHash) { "OK" } else { "FAILED" }
|
|
||||||
IsError = $false
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
$displayPath = $item.TargetFile;
|
|
||||||
if ($item.BaseDir -ne (Get-Location).Path) {
|
|
||||||
$displayPath = Join-Path -Path (Resolve-Path -Path ($item.BaseDir) -Relative -ErrorAction 'SilentlyContinue') -ChildPath ($item.TargetFile);
|
|
||||||
if ($displayPath.StartsWith(".\") -or $displayPath.StartsWith("./")) { $displayPath = $displayPath.Substring(2); }
|
|
||||||
}
|
|
||||||
[PSCustomObject]@{
|
|
||||||
DisplayPath = $displayPath
|
|
||||||
Status = "FAILED open or read"
|
|
||||||
IsError = $true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} -ThrottleLimit 16 | ForEach-Object {
|
|
||||||
$currentIndex++
|
|
||||||
if ($totalFiles -gt 0) {
|
|
||||||
Write-Progress -Activity "Verifying Checksums ($fileAlgo)" -Status "Processing file $currentIndex of $totalFiles" -PercentComplete (($currentIndex / $totalFiles) * 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host "$($_.DisplayPath): " -NoNewline;
|
|
||||||
if ($_.IsError) {
|
|
||||||
Write-Host "$($_.Status)" -ForegroundColor Red;
|
|
||||||
} elseif ($_.Status -eq "OK") {
|
|
||||||
Write-Host "OK" -ForegroundColor Green;
|
|
||||||
} else {
|
|
||||||
Write-Host "FAILED" -ForegroundColor Red;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Write-Progress -Activity "Verifying Checksums ($fileAlgo)" -Completed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
# --- GENERATION MODE ---
|
|
||||||
else {
|
|
||||||
if ([string]::IsNullOrWhiteSpace($Algorithm)) {
|
|
||||||
$Algorithm = 'SHA256';
|
|
||||||
}
|
|
||||||
|
|
||||||
$wantCustomOut = $PSBoundParameters.ContainsKey('OutFile');
|
|
||||||
$wantAutoOut = $Save.IsPresent;
|
|
||||||
|
|
||||||
if ($wantCustomOut -or $wantAutoOut) {
|
|
||||||
if ($Recursive -and $isWildcardGlobal) {
|
|
||||||
$groupedItems = $allItems | Group-Object DirectoryName;
|
|
||||||
|
|
||||||
foreach ($group in ($groupedItems)) {
|
|
||||||
$dirPath = $group.Name;
|
|
||||||
$filesInDir = $group.Group;
|
|
||||||
|
|
||||||
if ($wantCustomOut) {
|
|
||||||
$currentOutFile = Join-Path -Path ($dirPath) -ChildPath ($OutFile);
|
|
||||||
} else {
|
|
||||||
$currentOutFile = Join-Path -Path ($dirPath) -ChildPath "checksums.$($Algorithm.ToLower())";
|
|
||||||
}
|
|
||||||
|
|
||||||
$totalFiles = $filesInDir.Count;
|
|
||||||
$currentIndex = 0;
|
|
||||||
$linesToWrite = @();
|
|
||||||
|
|
||||||
$filesInDir | ForEach-Object -Parallel {
|
|
||||||
$item = $_
|
|
||||||
$algo = $using:Algorithm
|
|
||||||
|
|
||||||
$hash = (Get-FileHash -Path ($item.FullName) -Algorithm ($algo)).Hash.ToLower();
|
|
||||||
|
|
||||||
$relativePath = Resolve-Path -Path ($item.FullName) -Relative -ErrorAction 'SilentlyContinue';
|
|
||||||
if (-not $relativePath) { $relativePath = $item.Name; }
|
|
||||||
if ($relativePath.StartsWith(".\") -or $relativePath.StartsWith("./")) {
|
|
||||||
$relativePath = $relativePath.Substring(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
[PSCustomObject]@{
|
|
||||||
Item = $item
|
|
||||||
Hash = $hash
|
|
||||||
RelativePath = $relativePath
|
|
||||||
OutputLine = "${hash} ${relativePath}"
|
|
||||||
ItemOutFile = "$($item.FullName).$($algo.ToLower())"
|
|
||||||
}
|
|
||||||
} -ThrottleLimit 16 | ForEach-Object {
|
|
||||||
$currentIndex++;
|
|
||||||
if ($showProgress -and $totalFiles -gt 0) {
|
|
||||||
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Status "Directory: $(Split-Path $dirPath -Leaf) [$currentIndex/$totalFiles]" -PercentComplete (($currentIndex / $totalFiles) * 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
$linesToWrite += $_.OutputLine;
|
|
||||||
Write-Output $_.OutputLine;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($showProgress) {
|
|
||||||
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Completed;
|
|
||||||
}
|
|
||||||
|
|
||||||
Set-Content -Path ($currentOutFile) -Value $linesToWrite -Encoding utf8;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
if ($wantCustomOut -or ($wantAutoOut -and $isWildcardGlobal)) {
|
|
||||||
if ($wantCustomOut) {
|
|
||||||
$singleOutFile = $OutFile;
|
|
||||||
} else {
|
|
||||||
$singleOutFile = "checksums.$($Algorithm.ToLower())";
|
|
||||||
}
|
|
||||||
|
|
||||||
$totalFiles = $allItems.Count;
|
|
||||||
$currentIndex = 0;
|
|
||||||
$linesToWrite = @();
|
|
||||||
|
|
||||||
$allItems | ForEach-Object -Parallel {
|
|
||||||
$item = $_
|
|
||||||
$algo = $using:Algorithm
|
|
||||||
|
|
||||||
$hash = (Get-FileHash -Path ($item.FullName) -Algorithm ($algo)).Hash.ToLower();
|
|
||||||
|
|
||||||
$relativePath = Resolve-Path -Path ($item.FullName) -Relative -ErrorAction 'SilentlyContinue';
|
|
||||||
if (-not $relativePath) { $relativePath = $item.Name; }
|
|
||||||
if ($relativePath.StartsWith(".\") -or $relativePath.StartsWith("./")) {
|
|
||||||
$relativePath = $relativePath.Substring(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
[PSCustomObject]@{
|
|
||||||
Item = $item
|
|
||||||
Hash = $hash
|
|
||||||
RelativePath = $relativePath
|
|
||||||
OutputLine = "${hash} ${relativePath}"
|
|
||||||
ItemOutFile = "$($item.FullName).$($algo.ToLower())"
|
|
||||||
}
|
|
||||||
} -ThrottleLimit 16 | ForEach-Object {
|
|
||||||
$currentIndex++;
|
|
||||||
if ($showProgress -and $totalFiles -gt 0) {
|
|
||||||
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Status "Processing file $currentIndex of $totalFiles" -PercentComplete (($currentIndex / $totalFiles) * 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
$linesToWrite += $_.OutputLine;
|
|
||||||
Write-Output $_.OutputLine;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($showProgress) {
|
|
||||||
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Completed;
|
|
||||||
}
|
|
||||||
|
|
||||||
Set-Content -Path ($singleOutFile) -Value $linesToWrite -Encoding utf8;
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$totalFiles = $allItems.Count;
|
|
||||||
$currentIndex = 0;
|
|
||||||
|
|
||||||
$allItems | ForEach-Object -Parallel {
|
|
||||||
$item = $_
|
|
||||||
$algo = $using:Algorithm
|
|
||||||
|
|
||||||
$hash = (Get-FileHash -Path ($item.FullName) -Algorithm ($algo)).Hash.ToLower();
|
|
||||||
|
|
||||||
$relativePath = Resolve-Path -Path ($item.FullName) -Relative -ErrorAction 'SilentlyContinue';
|
|
||||||
if (-not $relativePath) { $relativePath = $item.Name; }
|
|
||||||
if ($relativePath.StartsWith(".\") -or $relativePath.StartsWith("./")) {
|
|
||||||
$relativePath = $relativePath.Substring(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
[PSCustomObject]@{
|
|
||||||
Item = $item
|
|
||||||
Hash = $hash
|
|
||||||
RelativePath = $relativePath
|
|
||||||
OutputLine = "${hash} ${relativePath}"
|
|
||||||
ItemOutFile = "$($item.FullName).$($algo.ToLower())"
|
|
||||||
}
|
|
||||||
} -ThrottleLimit 16 | ForEach-Object {
|
|
||||||
$currentIndex++;
|
|
||||||
if ($showProgress -and $totalFiles -gt 0) {
|
|
||||||
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Status "Processing file $currentIndex of $totalFiles" -PercentComplete (($currentIndex / $totalFiles) * 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Output $_.OutputLine;
|
|
||||||
Set-Content -Path ($_.ItemOutFile) -Value $_.OutputLine -Encoding utf8;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($showProgress) {
|
|
||||||
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Completed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
$totalFiles = $allItems.Count;
|
|
||||||
$currentIndex = 0;
|
|
||||||
|
|
||||||
$allItems | ForEach-Object -Parallel {
|
|
||||||
$item = $_
|
|
||||||
$algo = $using:Algorithm
|
|
||||||
|
|
||||||
$hash = (Get-FileHash -Path ($item.FullName) -Algorithm ($algo)).Hash.ToLower();
|
|
||||||
|
|
||||||
$relativePath = Resolve-Path -Path ($item.FullName) -Relative -ErrorAction 'SilentlyContinue';
|
|
||||||
if (-not $relativePath) { $relativePath = $item.Name; }
|
|
||||||
if ($relativePath.StartsWith(".\") -or $relativePath.StartsWith("./")) {
|
|
||||||
$relativePath = $relativePath.Substring(2);
|
|
||||||
}
|
|
||||||
|
|
||||||
[PSCustomObject]@{
|
|
||||||
Item = $item
|
|
||||||
Hash = $hash
|
|
||||||
RelativePath = $relativePath
|
|
||||||
OutputLine = "${hash} ${relativePath}"
|
|
||||||
ItemOutFile = "$($item.FullName).$($algo.ToLower())"
|
|
||||||
}
|
|
||||||
} -ThrottleLimit 16 | ForEach-Object {
|
|
||||||
$currentIndex++;
|
|
||||||
if ($showProgress -and $totalFiles -gt 0) {
|
|
||||||
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Status "Processing file $currentIndex of $totalFiles" -PercentComplete (($currentIndex / $totalFiles) * 100);
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Output $_.OutputLine;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($showProgress) {
|
|
||||||
Write-Progress -Activity "Computing Checksums ($Algorithm)" -Completed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
param(
|
|
||||||
# powershell is factually gay idkl why its such a shit
|
|
||||||
[Parameter(Mandatory=$True, Position=0)] # deband the param, its in position 0 so ya canb just ffmpreg_gif_loopy filename.mp4 OR ffmpreg_gif_loopy -Filename filename.mp4
|
|
||||||
[string]$Filename # var for filename string
|
|
||||||
)
|
|
||||||
# apng is far hjigher quality and also preserves transparancy :activated:
|
|
||||||
$noextpath = [System.IO.Path]::GetFileNameWithoutExtension($Filename) # get filename without extension
|
|
||||||
$gifpath = "$noextpath`_MAXLOOP.gif" # add da .gif extension and MAXLOOP tag
|
|
||||||
|
|
||||||
# ffmpeg
|
|
||||||
## -i input file (mp4)
|
|
||||||
## settings for -filter_complex purely vibe coded for max quality
|
|
||||||
### split [a][b]: Splitting clones the video stream into two identical, simultaneous feeds. This lets you process the color palette and render the GIF all in one
|
|
||||||
### palettegen=stats_mode=single: This generates the highest quality 256-color palette based strictly on the exact colors present in your video. Changing the mode to single tells FFmpeg to optimize colors for moving objects across frames.
|
|
||||||
### paletteuse=dither=bayer:bayer_scale=5: This dictates how colors are blended. Using a strict bayer dither with a scale of 5 keeps gradients incredibly clean and crisp, eliminating the ugly "cross-hatch" or "grainy" patterns typical of basic GIFs
|
|
||||||
## -loop 0 maek da gif loop
|
|
||||||
## outputfile (gif)
|
|
||||||
ffmpeg -i "$Filename" -filter_complex "[0:v] split [a][b];[a] palettegen=stats_mode=single [p];[b][p] paletteuse=dither=bayer:bayer_scale=5" -loop 0 "$gifpath"
|
|
||||||
@@ -1,150 +0,0 @@
|
|||||||
# todo: sanity checks for if x wsl is installed and x v2, if x usbipd is installed, if the user is running powershell >-7
|
|
||||||
# x if wsl is not installed, install it
|
|
||||||
# x if usbipd is not installed, install it
|
|
||||||
# if wsl is not version 2, upgrade it
|
|
||||||
|
|
||||||
# :pope: may work
|
|
||||||
#Requires -RunAsAdministrator
|
|
||||||
|
|
||||||
# llm cancer string that amkes it run as admin
|
|
||||||
if (!([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
|
|
||||||
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File `"$PSCommandPath`"" -Verb RunAs
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
|
|
||||||
# detach and unbind all devices and exit
|
|
||||||
if($args[0] -eq "detach") {
|
|
||||||
Write-Host "Detaching and Unbinding all USB devices from WSL"
|
|
||||||
usbipd detach --all
|
|
||||||
usbipd unbind --all
|
|
||||||
Write-Host "All USB devices have been detached and unbound from WSL"
|
|
||||||
Write-Host "Press Any Key To Exit"
|
|
||||||
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
|
|
||||||
# list devices and exit
|
|
||||||
if ($args[0] -eq "list") {
|
|
||||||
Write-Host "Listing USB devices attached to WSL"
|
|
||||||
usbipd list
|
|
||||||
|
|
||||||
Write-Host "Press Any Key To Exit"
|
|
||||||
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
|
|
||||||
# help bs
|
|
||||||
if ($args[0] -eq "help") {
|
|
||||||
Write-Host "Usage: .\get_wsl_usb.ps1 [options]"
|
|
||||||
Write-Host "Options:"
|
|
||||||
Write-Host " attach Attach a USB device to WSL (default action if no options are provided)"
|
|
||||||
Write-Host " detach Detach and unbind all USB devices from WSL"
|
|
||||||
Write-Host " list List USB devices attached to WSL"
|
|
||||||
Write-Host " help Display this help message"
|
|
||||||
Write-Host "If no options are provided, the script will list USB devices and allow you to attach one to WSL."
|
|
||||||
Write-Host "Press Any Key To Exit"
|
|
||||||
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
|
|
||||||
# now sanity/env checks
|
|
||||||
## check if wsl installed is version 2, if not upgrade it it
|
|
||||||
function Check-WSLVersion {
|
|
||||||
<#
|
|
||||||
.SYNOPSIS
|
|
||||||
Check if WSL is version 2 and upgrade if necessary.
|
|
||||||
|
|
||||||
.DESCRIPTION
|
|
||||||
This function checks the installed WSL version and upgrades to WSL 2 if needed.
|
|
||||||
#>
|
|
||||||
|
|
||||||
# Get WSL status
|
|
||||||
$wslStatus = wsl --status 2>&1
|
|
||||||
|
|
||||||
# Check if WSL 2 is available (look for WSL 2 in status output)
|
|
||||||
if ($wslStatus -match "WSL version:\s+\d") {
|
|
||||||
if ($wslStatus -match "Default distribution version:\s+2") {
|
|
||||||
Write-Host "WSL 2 is already installed and set as default."
|
|
||||||
return $true
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
Write-Host "WSL 1 detected. Attempting to upgrade to WSL 2..."
|
|
||||||
try {
|
|
||||||
wsl --update
|
|
||||||
Write-Host "WSL has been updated. Please restart your computer and run this script again."
|
|
||||||
return $false
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
Write-Host "Error updating WSL: $_"
|
|
||||||
return $false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
# Fallback: try to get list of distributions
|
|
||||||
$wslList = wsl --list -v 2>&1
|
|
||||||
if ($wslList -match "VERSION\s+2") {
|
|
||||||
Write-Host "WSL 2 detected."
|
|
||||||
return $true
|
|
||||||
}
|
|
||||||
elseif ($wslList -match "VERSION\s+1") {
|
|
||||||
Write-Host "WSL 1 detected. Upgrading to WSL 2..."
|
|
||||||
try {
|
|
||||||
$distros = $wslList | Where-Object { $_ -match "^[^*]" } | ForEach-Object { ($_ -split '\s+')[0] } | Where-Object { $_ -and $_ -ne "NAME" }
|
|
||||||
foreach ($distro in $distros) {
|
|
||||||
Write-Host "Upgrading $distro to WSL 2..."
|
|
||||||
wsl --set-version $distro 2
|
|
||||||
}
|
|
||||||
Write-Host "Distros have been upgraded to WSL 2."
|
|
||||||
return $true
|
|
||||||
}
|
|
||||||
catch {
|
|
||||||
Write-Host "Error upgrading WSL: $_"
|
|
||||||
return $false
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return $false
|
|
||||||
}
|
|
||||||
|
|
||||||
## if wsl not installed, install it
|
|
||||||
if (-not (Get-Command wsl -ErrorAction SilentlyContinue)) {
|
|
||||||
Write-Host "WSL is not installed. Installing WSL..."
|
|
||||||
wsl --install
|
|
||||||
Write-Host "WSL has been installed. Please restart your computer and run this script again."
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
|
|
||||||
## Check WSL version and upgrade if needed
|
|
||||||
# if (-not (Check-WSLVersion)) {
|
|
||||||
# Write-Host "WSL upgrade required. Please restart your computer and run this script again."
|
|
||||||
# }
|
|
||||||
|
|
||||||
# do the wsl version check and upgrade if needed before we do anything else
|
|
||||||
if (-not (Get-Command usbipd -ErrorAction SilentlyContinue)) {
|
|
||||||
Write-Host "usbipd is not installed. Installing usbipd..."
|
|
||||||
winget install usbipd
|
|
||||||
Write-Host "usbipd has been installed."
|
|
||||||
}
|
|
||||||
|
|
||||||
# Your code goes here
|
|
||||||
Write-Host "Admin Perms Confirmed!"
|
|
||||||
Write-Host "Launching WSL"
|
|
||||||
# lanch in enew window so we can run usbipd commands in the current one
|
|
||||||
Start-Process pwsh.exe "-NoExit","-Command", "wsl", "-d", "kali-wsl"
|
|
||||||
# Write-Host "Press Any Key To Continue"
|
|
||||||
# Clear-Host
|
|
||||||
Write-Host "Listing usb devices, remember the busid (ex. 1-3) of the device you wish to attach to WSL"
|
|
||||||
usbipd list
|
|
||||||
# Write-Host "Press Any Key To Continue"
|
|
||||||
# $null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|
|
||||||
$BUSID = Read-Host "Enter The BUSID of the USB Device You Wish to Attach to WSL"
|
|
||||||
Clear-Host
|
|
||||||
Write-Host "Attaching USB Device with BUSID $BUSID"
|
|
||||||
usbipd bind --force --busid $BUSID
|
|
||||||
usbipd attach --wsl --busid $BUSID
|
|
||||||
Write-Host "USB Device With BUSID $BUSID Has Been Attached to WSL"
|
|
||||||
Write-Host "Press Any Key To Exit"
|
|
||||||
$null = $Host.UI.RawUI.ReadKey("NoEcho,IncludeKeyDown")
|
|
||||||
exit
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
if ($args) {
|
|
||||||
$message=$args -join ' '
|
|
||||||
} else {
|
|
||||||
if(test-path './version.txt') {
|
|
||||||
$message = $(get-content './version.txt')
|
|
||||||
} else {
|
|
||||||
$message = $(Get-Date -uformat "%s")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "git commit message: '$message'"
|
|
||||||
|
|
||||||
git add .
|
|
||||||
git commit -m "$message"
|
|
||||||
git push
|
|
||||||
|
|
||||||
echo "Done :3"
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
# todo, param and defaults these up
|
|
||||||
$remote_dir = "/var/www/html/Media-Viewer"
|
|
||||||
$remote_host = "pi3"
|
|
||||||
$remote_cmd = "echo REMOTE pull $remote_dir; git -C $remote_dir pull; echo REMOTE add $remote_diradding; git -C $remote_dir add .; echo REMOTE commit $remote_dir; git -C $remote_dir commit -m `$(date +%s); echo REMOTE push $remote_dir; git -C $remote_dir push; echo -e `"\nREMOTE status $remote_dir\n`"; git -C $remote_dir status;"
|
|
||||||
|
|
||||||
echo "`nLOCAL pulling`n"
|
|
||||||
git pull
|
|
||||||
|
|
||||||
echo "`nLOCAL adding, comitting and pushing`n"
|
|
||||||
gitshit # usin gitshit here lmfao maybe make message a param
|
|
||||||
|
|
||||||
echo "`nLOCAL status`n"
|
|
||||||
git status
|
|
||||||
|
|
||||||
# run da REMOTE
|
|
||||||
echo "`nREMOTE running sync"
|
|
||||||
ssh $remote_host "/bin/bash -c $remote_cmd"
|
|
||||||
|
|
||||||
echo "`nLOCAL status`n"
|
|
||||||
git status
|
|
||||||
@@ -1,99 +0,0 @@
|
|||||||
[CmdletBinding()]
|
|
||||||
param(
|
|
||||||
# First string to compare
|
|
||||||
[Parameter(Position = 0)]
|
|
||||||
[string]$String1,
|
|
||||||
|
|
||||||
# Second string to compare
|
|
||||||
[Parameter(Position = 1)]
|
|
||||||
[string]$String2,
|
|
||||||
|
|
||||||
# Optional switch to enable case-sensitive comparison
|
|
||||||
[switch]$CaseSensitive,
|
|
||||||
|
|
||||||
# Help flag (-h, -Help)
|
|
||||||
[Alias('h')]
|
|
||||||
[switch]$Help
|
|
||||||
)
|
|
||||||
|
|
||||||
begin {
|
|
||||||
function Show-Help {
|
|
||||||
@'
|
|
||||||
NAME
|
|
||||||
match - Compare two strings and output visual match status
|
|
||||||
|
|
||||||
SYNOPSIS
|
|
||||||
match <String1> <String2> [-CaseSensitive]
|
|
||||||
match -Help
|
|
||||||
|
|
||||||
DESCRIPTION
|
|
||||||
Compares two string arguments.
|
|
||||||
Outputs "Match OK" in GREEN if they match.
|
|
||||||
Outputs "FAIL: NO MATCH" in RED if they differ.
|
|
||||||
|
|
||||||
PARAMETERS
|
|
||||||
String1
|
|
||||||
The first string to compare.
|
|
||||||
|
|
||||||
String2
|
|
||||||
The second string to compare.
|
|
||||||
|
|
||||||
-CaseSensitive
|
|
||||||
Perform a case-sensitive comparison (default is case-insensitive).
|
|
||||||
|
|
||||||
-h, -Help, h, help (case insensitive)
|
|
||||||
Display this help message.
|
|
||||||
|
|
||||||
EXAMPLES
|
|
||||||
1. Compare two strings (case-insensitive default):
|
|
||||||
match "hello" "Hello"
|
|
||||||
Output: Match OK (in green)
|
|
||||||
|
|
||||||
2. Compare two strings with case sensitivity:
|
|
||||||
match "hello" "Hello" -CaseSensitive
|
|
||||||
Output: FAIL: NO MATCH (in red)
|
|
||||||
|
|
||||||
3. Compare hashes or checksum outputs:
|
|
||||||
match "e3b0c442" "e3b0c442"
|
|
||||||
Output: Match OK (in green)
|
|
||||||
'@
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
process {
|
|
||||||
# Check if help was explicitly requested via flag or positional parameter
|
|
||||||
$isHelpRequested = $Help.IsPresent -or (
|
|
||||||
$PSBoundParameters.Count -gt 0 -and (
|
|
||||||
($String1 -and $String1 -match '^(?i)[-/]{0,2}(h|help)$') -or
|
|
||||||
($String2 -and $String2 -match '^(?i)[-/]{0,2}(h|help)$')
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
if ($isHelpRequested) {
|
|
||||||
Show-Help
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
# Trigger help usage if either string parameter is missing or whitespace
|
|
||||||
if ([string]::IsNullOrWhiteSpace($String1) -or [string]::IsNullOrWhiteSpace($String2)) {
|
|
||||||
Write-Host "Error: Missing required arguments." -ForegroundColor Yellow
|
|
||||||
Write-Host "Usage: match <String1> <String2> [-CaseSensitive]" -ForegroundColor Cyan
|
|
||||||
Write-Host "Run 'match -Help' for detailed documentation.`n"
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
# Compare strings based on case-sensitivity choice
|
|
||||||
$isMatch = if ($CaseSensitive) {
|
|
||||||
$String1 -ceq $String2
|
|
||||||
} else {
|
|
||||||
$String1 -eq $String2
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($isMatch) {
|
|
||||||
Write-Host "`n`nSUCCESS: MATCH OK!`n`n" -ForegroundColor Green
|
|
||||||
} else {
|
|
||||||
Write-Host "`n`nFAIL: NO MATCH!`n`n" -ForegroundColor Red
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
end {}
|
|
||||||
@@ -1,85 +0,0 @@
|
|||||||
param (
|
|
||||||
[Parameter(Mandatory = $true, Position = 0)]
|
|
||||||
[string]$Ext1,
|
|
||||||
|
|
||||||
[Parameter(Mandatory = $true, Position = 1)]
|
|
||||||
[string]$Ext2,
|
|
||||||
|
|
||||||
[int]$Jobs = 4 # Number of simultaneous conversions
|
|
||||||
)
|
|
||||||
|
|
||||||
$sourceExt = $Ext1.TrimStart('.')
|
|
||||||
$targetExt = $Ext2.TrimStart('.')
|
|
||||||
$audioExts = @('opus', 'ogg', 'flac', 'wav')
|
|
||||||
|
|
||||||
$files = Get-ChildItem -File -Recurse -Filter "*.$sourceExt"
|
|
||||||
|
|
||||||
if ($files.Count -eq 0) {
|
|
||||||
Write-Host "No files matching *.$sourceExt found." -ForegroundColor Yellow
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host "Starting conversion using $Jobs parallel jobs..." -ForegroundColor Green
|
|
||||||
|
|
||||||
$files | ForEach-Object -Parallel {
|
|
||||||
$file = $_
|
|
||||||
$targetExt = $using:targetExt
|
|
||||||
$audioExts = $using:audioExts
|
|
||||||
|
|
||||||
$outputPath = Join-Path -Path $file.DirectoryName -ChildPath "$($file.BaseName).$targetExt"
|
|
||||||
$relativePath = Resolve-Path -Path $file.FullName -Relative
|
|
||||||
|
|
||||||
Write-Host "Processing: $relativePath" -ForegroundColor Cyan
|
|
||||||
|
|
||||||
if ($audioExts -contains $targetExt.ToLower()) {
|
|
||||||
ffmpeg -y -i $file.FullName -c:a libopus -b:a 128k -vbr on $outputPath 2>$null
|
|
||||||
} else {
|
|
||||||
# -preset 8 drastically speeds up SVT-AV1 while maintaining high quality
|
|
||||||
ffmpeg -y -i $file.FullName -c:v libsvtav1 -crf 26 -preset 8 -c:a libopus -b:a 128k $outputPath 2>$null
|
|
||||||
}
|
|
||||||
} -ThrottleLimit $Jobs
|
|
||||||
|
|
||||||
Write-Host "Finished processing $($files.Count) file(s)." -ForegroundColor Green
|
|
||||||
|
|
||||||
# -------------------------------------------------------------------------
|
|
||||||
# Step 1: Recursively delete all existing .sha256 files
|
|
||||||
# -------------------------------------------------------------------------
|
|
||||||
Write-Host "Deleting existing .sha256 files recursively..." -ForegroundColor Yellow
|
|
||||||
Get-ChildItem -Path . -Recurse -Filter "*.sha256" -File | Remove-Item -Force
|
|
||||||
|
|
||||||
# -------------------------------------------------------------------------
|
|
||||||
# Step 2: Run checksums in current directory and every subdirectory
|
|
||||||
# -------------------------------------------------------------------------
|
|
||||||
Write-Host "Generating checksums in each subfolder..." -ForegroundColor Cyan
|
|
||||||
|
|
||||||
# Gather current working directory and all child directories
|
|
||||||
$allDirs = @((Get-Item .).FullName) + (Get-ChildItem -Path . -Recurse -Directory | Select-Object -ExpandProperty FullName)
|
|
||||||
|
|
||||||
foreach ($dir in $allDirs) {
|
|
||||||
Push-Location $dir
|
|
||||||
try {
|
|
||||||
Write-Host "Updating checksums in: $dir" -ForegroundColor Gray
|
|
||||||
checksum * -o
|
|
||||||
} finally {
|
|
||||||
Pop-Location
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
# -------------------------------------------------------------------------
|
|
||||||
# Step 3: Recursively verify checksums in each directory
|
|
||||||
# -------------------------------------------------------------------------
|
|
||||||
Write-Host "Verifying checksums in each subfolder..." -ForegroundColor Cyan
|
|
||||||
|
|
||||||
foreach ($dir in $allDirs) {
|
|
||||||
Push-Location $dir
|
|
||||||
try {
|
|
||||||
if (Test-Path "checksums.sha256") {
|
|
||||||
Write-Host "Verifying: $dir" -ForegroundColor Gray
|
|
||||||
checksum -c checksums.sha256
|
|
||||||
}
|
|
||||||
} finally {
|
|
||||||
Pop-Location
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host "All conversions, checksum creations, and verifications completed successfully." -ForegroundColor Green
|
|
||||||
@@ -1,25 +0,0 @@
|
|||||||
$counter = 1;
|
|
||||||
$paths_file = ".\paths.txt"
|
|
||||||
$destination_dir = ""
|
|
||||||
$sleep_seconds = 90
|
|
||||||
|
|
||||||
# infinite loop to run through to and loop every $sleep_seconds seconeds
|
|
||||||
while($true) {
|
|
||||||
Write-Host "`n`nNew Rotation!`n`tRotation $counter `n`tCopying...`n`n"
|
|
||||||
# loop through paths in $paths_file
|
|
||||||
foreach($line in Get-Content "$paths_file") {
|
|
||||||
Clear-Host
|
|
||||||
Write-Host "Handling $line on rotation $counter"
|
|
||||||
# copy the path
|
|
||||||
$path = $line
|
|
||||||
# split $line by \ and return last element
|
|
||||||
$dirname = $line -split "\\" | Select-Object -Last 1
|
|
||||||
# do the copy
|
|
||||||
robocopy /e /z $path $destination_dir\$dirname
|
|
||||||
}
|
|
||||||
Clear-Host
|
|
||||||
Write-Host "`n`nFinished Rotation $counter`n`tSleeping 90 Seconds...`n`n"
|
|
||||||
# sleep wont start until robopy loop is finished
|
|
||||||
Start-Sleep -Seconds $sleep_seconds # sleep $sleep_seconds seconds
|
|
||||||
$counter++;
|
|
||||||
}
|
|
||||||
@@ -1,38 +0,0 @@
|
|||||||
# TEXT TO ASCII ART GENERATOR https://patorjk.com/software/taag/#p=display&f=Graceful&t=PRINCESS+PI&x=none&v=4&h=4&w=80&we=false
|
|
||||||
# IMAGE TO ASCII ART GENERATOR https://www.asciiart.eu/image-to-ascii
|
|
||||||
Clear-Host # cleanup
|
|
||||||
Write-Host -ForegroundColor Magenta @'
|
|
||||||
=--= =----=
|
|
||||||
=--= -------=
|
|
||||||
=--= --------=
|
|
||||||
=----= --- =---------=
|
|
||||||
----= =--- ---==++=----:-----=
|
|
||||||
=-----= - ---- ========----::----=
|
|
||||||
=------= ----=+===-::::::::=+**++===+#
|
|
||||||
==-----=----=+**+=:::-======++******+==+##
|
|
||||||
=------=-=+*:::-=============+*****+==+*##
|
|
||||||
=------=+=:-++==--+=++===+====+***+===***=
|
|
||||||
=--------+*===---+===+===+++==+**=+==+**+-
|
|
||||||
=------=+===--=+++==++++%%*==**====+**+.- -
|
|
||||||
#=---=+====-=+++=+++*+.%+-==**=-==+**+.. --
|
|
||||||
#**+--+========++++#%#**=--==**--==+**=..: =-
|
|
||||||
*****+======+-+++*%%@@%=---==**--+=+*--:..- =
|
|
||||||
#*****=====+=-=++***#%#-----=**=-+=+*=---:.. %%
|
|
||||||
%****+====+=--=+++.:+*=-------=*-===**=---:..- %%
|
|
||||||
#***+=====------=:.-=----------==+=+**+---...: %%%%#%
|
|
||||||
#**+====:---------=-------------+=+=***=-....: %%##%%##
|
|
||||||
%***====..:---------------------==+=-****:.....+%#%%#%%%%#
|
|
||||||
#**+==*=...---------------:.----+==--=***=....##%#######%%
|
|
||||||
#***+=+*=...--------------:..:--=+=----+***:...#%###%%##%
|
|
||||||
#**+==+*=..:-------------:...:--++------=***.:+##%#%%%#% =
|
|
||||||
#***+==+**...:----------:.....:--+=------==**++##%#%%%%% =-
|
|
||||||
#***#+==+**=.................+*---+=------=#+=##%%##%%%#%=---
|
|
||||||
%#**#%*===+***-.....---...=+.:*#=----------=##*#%####%%%%#=----
|
|
||||||
%#### +===****-...: -+##=#%%+---------+###%%%%%%#%%%%%*-----
|
|
||||||
*===+****-..- %###%%%+------=*######%%%%%%%##%#*------
|
|
||||||
+===+****-.- %##%%%*-----#########%####%#####*-------
|
|
||||||
____ ____ __ __ _ ___ ____ ____ ____ ____ __
|
|
||||||
( _ \( _ \( )( ( \ / __)( __)/ ___)/ ___) ( _ \( )
|
|
||||||
) __/ ) / )( / /( (__ ) _) \___ \\___ \ ) __/ )(
|
|
||||||
(__) (__\_)(__)\_)__) \___)(____)(____/(____/ (__) (__)
|
|
||||||
'@
|
|
||||||
@@ -1,74 +0,0 @@
|
|||||||
# `pwsh.exe -c "`"C:\path\to\redundant-backup.ps1`" -logFile `"`" -simpleLogFile `"`""`
|
|
||||||
# `Start-Process -filepath "C:\path\to\redundant-backup.ps1" -logFile "" -simpleLogFile ""`
|
|
||||||
# `redundant-backup -logFile "" -simpleLogFile ""`
|
|
||||||
param([string] $logFile,
|
|
||||||
[string] $simpleLogFile
|
|
||||||
)
|
|
||||||
|
|
||||||
$startUnixSeconds = get-date -uformat "%s" # unix epoch seconds for duration
|
|
||||||
$startDateHuman = get-date # human readable begin date
|
|
||||||
$startDateFilename = get-date -format 'yyyy-MM-dd-hhmm' # filename friendly date format
|
|
||||||
|
|
||||||
|
|
||||||
$warningFile = "C:\Users\human\OneDrive\Desktop\backup_error_$startDateFilename.log" # file to create to notify of a failure
|
|
||||||
|
|
||||||
$jobName = "Weekly-Backup-$startDateFilename" # name for job in case wanna restart an interrupted one
|
|
||||||
$resticRunning = "E:\restic_backups_rolling" # from dir (restic)
|
|
||||||
|
|
||||||
$redundantLocal = "D:\restic_backups_redundancy_rolling" # to dir (local drive)
|
|
||||||
$redundantLocalNetwork = "R:\restics_backups_redundancy_rolling" # to dir (network mapped drive location)
|
|
||||||
$redundantAirGap = "S:\restic_backups_redundancy_rolling" # set backup usb to use S
|
|
||||||
|
|
||||||
$logGuideString = "Verb | Current Date and Time (Current Time Unix Seconds) | Start Date and Time (Start Time Unix Seconds) | Time Elapsed in Seconds | From Directory | To Directory | Job Name | Exit Status"
|
|
||||||
|
|
||||||
function appendToLog {
|
|
||||||
param([string]$verb="INFO", [string]$exitCode="NONE", [string]$log="$logFile", [string]$fromDir="NONE", [string]$toDir="NONE")
|
|
||||||
|
|
||||||
$timeCalc = $(Get-Date -uformat "%s")-$startUnixSeconds
|
|
||||||
|
|
||||||
# Verb | Current Date and Time (Current Time Unix Seconds) | Start Date and Time (Start Time Unix Seconds) | Time Elapsed in Seconds | From Directory | To Directory | Job Name | Exit Status
|
|
||||||
$logString = "$verb | $(Get-Date) ($(Get-Date -uformat "%s")) | $startDateHuman ($startUnixSeconds) | $timeCalc | $fromDir | $toDir | $jobName | $exitCode"
|
|
||||||
|
|
||||||
echo "$logString"
|
|
||||||
echo "$logString" >> "$log"
|
|
||||||
}
|
|
||||||
|
|
||||||
function appendToErrorLog {
|
|
||||||
param ( $exceptionMessage, $part )
|
|
||||||
$errorString = "`nFAIL on $part`nException: $exceptionMessage`nVars:`n`tstartDateHuman: $startDateHuman`n`tstart: $startUnixSecondsUnixSecons`n`tappendToErrorLog: $appendToErrorLog`n`tlogFile: $logFile`n`twarningFile: $warningFile`n`tresticRunning: $resticRunning`n`tredundantLocal: $redundantLocal`n`tredundantLocalNetwork: $redundantLocalNetwork`n`tjobName: $jobName"
|
|
||||||
|
|
||||||
echo "$errorString"
|
|
||||||
try { echo "$errorString" > "$warningFile" } catch { echo "Error: $warningFile Not Found" }
|
|
||||||
}
|
|
||||||
|
|
||||||
function doBackup {
|
|
||||||
param ( [string]$fromDir="NONE", [string]$toDir="NONE", [string]$tagString="INFO" )
|
|
||||||
|
|
||||||
echo "`n$tagString"
|
|
||||||
echo "`tFollow log with:`n`t`tGet-Content `"$logFile`" -Wait -Tail 10`n"
|
|
||||||
|
|
||||||
appendToLog -verb "START-$tagString" -log "$logFile" -toDir "$toDir" -fromDir "$fromDir"
|
|
||||||
robocopy "$fromDir" "$toDir" /E /Z /FP /NP /R:2 /W:1 /SAVE:"$jobString" /LOG+:"$logFile"
|
|
||||||
appendToLog -verb "FINISH-$tagString" -exitCode "$?" -log "$logFile" -toDir "$toDir" -fromDir "$fromDir"
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "Initializing Logs"
|
|
||||||
|
|
||||||
touch "$runningFile"
|
|
||||||
|
|
||||||
echo "$logGuideString" > "$logFile"
|
|
||||||
appendToLog -verb "INITIALIZE-LOG-FILES" -exitCode "$?" -log "$logFile"
|
|
||||||
|
|
||||||
echo "`n$logGuideString`n"
|
|
||||||
|
|
||||||
# run da backupssss
|
|
||||||
doBackup -fromDir "$resticRunning" -toDir "$redundantLocal" -tagString "COPY-LOCAL" -jobString "$jobName" # local
|
|
||||||
appendToLog -verb "COPY-LOCAL" -exitCode "$?" -log "$logFile" -fromDir "$resticRunning" -toDir "$redundantLocal"
|
|
||||||
|
|
||||||
doBackup -fromDir "$resticRunning" -toDir "$redundantLocalNetwork" -tagString "COPY-LOCAL-NETWORK" -jobString "$jobName" # network
|
|
||||||
appendToLog -verb "COPY-LOCAL-NETWORK" -exitCode "$?" -log "$logFile" -fromDir "$resticRunning" -toDir "$redundantLocalNetwork"
|
|
||||||
|
|
||||||
doBackup -fromDir "$resticRunning" -toDir "$redundantAirGap" -tagString "COPY-AIRGAP" -jobString "$jobName" # airgap
|
|
||||||
appendToLog -verb "COPY-AIRGAP" -exitCode "$?" -log "$logFile" -fromDir "$resticRunning" -toDir "$redundantAirGap"
|
|
||||||
|
|
||||||
appendToLog -verb "DONE" -log "$logFile"
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
Param(
|
|
||||||
[string]$hosts_file = "subnets.txt",
|
|
||||||
[int]$delay_seconds = 120,
|
|
||||||
[int]$port = 5555,
|
|
||||||
[bool]$ChkDsk = $false
|
|
||||||
)
|
|
||||||
|
|
||||||
# infinitte looppsie
|
|
||||||
$counter = 1
|
|
||||||
while($True) {
|
|
||||||
Clear-Host # this ig iss the new clear/cls
|
|
||||||
|
|
||||||
Write-Host "Scanning $subnet for port $port loop count $counter`n"
|
|
||||||
# only show open ports, disable ping host check, output to stdout in greppable format on specified port for all subnets in hosts file
|
|
||||||
nmap --open -Pn -oG - -p $port -iL "$hosts_file"
|
|
||||||
$counter++
|
|
||||||
|
|
||||||
Write-Host "`nSleeping $delay_seconds Seconds`n"
|
|
||||||
Start-Sleep -Seconds $delay_seconds
|
|
||||||
}
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
param(
|
|
||||||
[string]
|
|
||||||
$session = 'pi3'
|
|
||||||
)
|
|
||||||
|
|
||||||
while($True) {
|
|
||||||
ssh $session
|
|
||||||
echo "Waiting 5 Seconds..."
|
|
||||||
sleep 5
|
|
||||||
wait-on-host -hostname $session
|
|
||||||
}
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
10.0.0.0/24
|
|
||||||
10.0.2.0/24
|
|
||||||
10.0.1.0/24
|
|
||||||
192.168.56.0/24
|
|
||||||
172.18.208.0/24
|
|
||||||
@@ -1,39 +0,0 @@
|
|||||||
# usage
|
|
||||||
## sync_media [NUKE]
|
|
||||||
|
|
||||||
# $media_viewer_dir="C:\Users\human\OneDrive\Documents\Git\Media-Viewer"
|
|
||||||
$media_viewer_dir_wsl="/mnt/c/Users/human/OneDrive/Documents/Git/Media-Viewer"
|
|
||||||
|
|
||||||
# select for nuke mode
|
|
||||||
if($args[0] -eq "NUKE") {
|
|
||||||
Write-Host "`nNUKE MODE ACTIVATED`n"
|
|
||||||
$nuke = $True
|
|
||||||
} else {
|
|
||||||
Write-Host "`nNormal Mode Activated`n"
|
|
||||||
$nuke = $False
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host "`nSillyfillyy synching media loleen`n"
|
|
||||||
|
|
||||||
# do da synchiedink
|
|
||||||
Write-Host "`n`bPERFORMING THE DILDOSYNC`n`n"
|
|
||||||
# wsl bash $media_viewer_dir_wsl/copy_local_wsl.sh
|
|
||||||
if($nuke) {
|
|
||||||
Write-Host "`nrunning sync with NUKE`n"
|
|
||||||
wsl bash $media_viewer_dir_wsl/dildo_new_full_sync_total.sh NUKE
|
|
||||||
} else {
|
|
||||||
Write-Host "`nNormal sync`n"
|
|
||||||
wsl bash $media_viewer_dir_wsl/dildo_new_full_sync_total.sh
|
|
||||||
}
|
|
||||||
|
|
||||||
# remote esp-idf
|
|
||||||
Write-Host "`nRunning esp-idf-tools update`n"
|
|
||||||
if($nuke) {
|
|
||||||
Write-Host "`nNUKE REBOOT esp-idf-tools `n"
|
|
||||||
ssh pi3 "bash /home/princesspi/esp/esp-idf-tools/esp-idf-tools-cmd.sh nr"
|
|
||||||
} else {
|
|
||||||
Write-Host "`nNormal esp-idf-tools update`n"
|
|
||||||
ssh pi3 "bash /home/princesspi/esp/esp-idf-tools/esp-idf-tools-cmd.sh"
|
|
||||||
}
|
|
||||||
|
|
||||||
Write-Host "`naahm done bein a sillyfilly fro noew`n"
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
$remote_host = "pi3"
|
|
||||||
$remote_dir = "/var/www/html/Media-Viewer"
|
|
||||||
|
|
||||||
echo "LOCAL: pulling"
|
|
||||||
git pull
|
|
||||||
|
|
||||||
echo "LOCAL: status"
|
|
||||||
git status
|
|
||||||
|
|
||||||
ssh $remote_host "echo 'REMOTE: pulling'; git -C $remote_dir pull; echo 'REMOTE: status'; git -C $remote_dir status"
|
|
||||||
Binary file not shown.
@@ -1,7 +0,0 @@
|
|||||||
# usage:
|
|
||||||
# testtime "some powershell command string"
|
|
||||||
param([string] $cmd)
|
|
||||||
$start=$(get-date -uformat "%s")
|
|
||||||
invoke-expression "$cmd"
|
|
||||||
$end=$(get-date -uformat "%s")
|
|
||||||
echo "`n`ntime: $($end - $start)`n`n"
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
# usage:
|
|
||||||
# `.\wait-on-host.ps1 -hostname <DOMAIN_NAME_OR_IP> -sleep <SECONDS_TO_SLEEP_PER_CYCLE> -pingcount <NUMBER_OF_TIMES_TO_PING_PER_ITERATION> -max <MAX_NUMBER_OF_ITERATIONS> -hold <SECONDS_TO_WAIT_AFTER_FIRST_RESPONSE>`
|
|
||||||
#
|
|
||||||
# defaults:
|
|
||||||
# hostname: cable-wind.local
|
|
||||||
# sleep: 25
|
|
||||||
# pingcount: 1
|
|
||||||
# max: 500
|
|
||||||
# hold: 30
|
|
||||||
# ex. `.\wait-on-host.ps1 -hostname google.com -sleep 10 -pingcount 5`
|
|
||||||
|
|
||||||
param(
|
|
||||||
[string]
|
|
||||||
$hostname = "cable-wind.local",
|
|
||||||
|
|
||||||
[int]
|
|
||||||
$sleep = 25,
|
|
||||||
|
|
||||||
[int]
|
|
||||||
$pingcount = 1,
|
|
||||||
|
|
||||||
[int]
|
|
||||||
$max = 500,
|
|
||||||
|
|
||||||
[bool]
|
|
||||||
$loop = 0, # 1 to loop
|
|
||||||
|
|
||||||
[int]
|
|
||||||
$hold = 30
|
|
||||||
)
|
|
||||||
|
|
||||||
if($hostname -eq 'help') {
|
|
||||||
echo "usage:`n`twait-on-host [help] -hostname <DOMAIN_NAME_OR_IP> -sleep <SECONDS_TO_SLEEP_PER_CYCLE> -pingcount <NUMBER_OF_TIMES_TO_PING_PER_ITERATION> -max <MAX_NUMBER_OF_ITERATIONS> -hold <SECONDS_TO_WAIT_AFTER_FIRST_RESPONSE>`n`twait-on-host help`n`t`tthis help message`n`twait-on-host 8.8.8.8`n`t`twait on 8.8.8.8 with defaults`n`tdefaults:`n`t`thostname: cable-wind.local`n`t`tsleep: 25`n`t`tpingcount: 1`n`t`tmax: 500`n`t`thold: 30`n`tex. wait-on-host -hostname google.com -sleep 10 -pingcount 5`n";
|
|
||||||
exit;
|
|
||||||
}
|
|
||||||
|
|
||||||
$iterations = 0;
|
|
||||||
|
|
||||||
while(1 -eq 1) { # infinite loop
|
|
||||||
echo "`nHost: $hostname" # Iterations: $iterations Count: $pingcount Sleep: $sleep Max: $max`n`tFlushing dns..."
|
|
||||||
echo "`tFlushing DNS"
|
|
||||||
ipconfig /flushdns >NUL 2>&1 # redirects output nowhere
|
|
||||||
if($?) {
|
|
||||||
echo "`t`tDone."
|
|
||||||
} else {
|
|
||||||
echo "`t`tFAILED TO FLUSH DNS! EXITING!"
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
|
|
||||||
echo "`tPinging..."
|
|
||||||
# $pingObj = Test-Connection -Count $pingcount -TargetName "$hostname" # powershell Test-Connection -Ping is default and redundant
|
|
||||||
$pingObj = Test-Connection -Count $pingcount -TargetName "$hostname" 2>&1
|
|
||||||
|
|
||||||
if($pingObj.Status -eq "Success") { # if return status of abopve (ping -n 1...) is True
|
|
||||||
# $pingObj = Test-Connection -Count $pingcount -TargetName "$hostname" # powershell Test-Connection -Ping is default and redundant
|
|
||||||
$ip = $pingObj.Address.IPAddressToString # get the bare ip out
|
|
||||||
|
|
||||||
echo "`t`tSuccess!`n`t`tIP: $ip`n`t`tHost: $hostname`n`t`tURL (host): http://$hostname`n`t`tURL (IP): http://$ip"
|
|
||||||
if($loop) {
|
|
||||||
echo "Sleeping $sleep Seconds..."
|
|
||||||
sleep $sleep # sleepy time
|
|
||||||
} else {
|
|
||||||
echo "`nWaiting $hold Seconds to Make Sure..."
|
|
||||||
sleep $hold
|
|
||||||
echo "`nReady!`n"
|
|
||||||
break
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
echo "`t`tNOT FOUND YET"
|
|
||||||
echo "`nSleeping $sleep Seconds..."
|
|
||||||
sleep $sleep # sleepy time
|
|
||||||
}
|
|
||||||
|
|
||||||
if($iterations -gt $max) {
|
|
||||||
echo "`nMAX ITERATIONS OF $max REACHED! EXITINTG`n"
|
|
||||||
exit
|
|
||||||
}
|
|
||||||
|
|
||||||
$iterations++
|
|
||||||
}
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
if ($args[0]) { $commit_message=($args -join " ") } # if arg0 exists, join all passed args with spaces
|
|
||||||
else { $commit_message="waypoint" } # or default to "waypoint"
|
|
||||||
|
|
||||||
Write-Host "WAYPOINT!`n`tCommit Message: $commit_message`n"
|
|
||||||
# add and commit
|
|
||||||
git add .
|
|
||||||
git commit -m "$commit_message"
|
|
||||||
|
|
||||||
Write-Host "`nDone :`"3"
|
|
||||||
@@ -1,21 +0,0 @@
|
|||||||
param (
|
|
||||||
[string]$messageContent = "PING!"
|
|
||||||
)
|
|
||||||
|
|
||||||
# get the ping tag
|
|
||||||
# in discord: \@role_name
|
|
||||||
$tag = $(Get-Content -Path "$PSScriptRoot\tag.txt")
|
|
||||||
$messageContent += "`n$tag"
|
|
||||||
|
|
||||||
# get webhook url from .\webhook.txt
|
|
||||||
$webhookUrl = $(Get-Content -Path "$PSScriptRoot\webhook.txt")
|
|
||||||
|
|
||||||
$payload = [PSCustomObject]@{
|
|
||||||
content = $messageContent
|
|
||||||
}
|
|
||||||
|
|
||||||
# Convert the payload to JSON format
|
|
||||||
$jsonPayload = $payload | ConvertTo-Json
|
|
||||||
|
|
||||||
# Send the POST request to the Discord webhook
|
|
||||||
Invoke-RestMethod -Uri $webhookUrl -Method Post -Body $jsonPayload -ContentType "Application/Json"
|
|
||||||
@@ -1,152 +0,0 @@
|
|||||||
# Usage:
|
|
||||||
# Open PowerShell as Administrator
|
|
||||||
# win+x
|
|
||||||
# alt+a
|
|
||||||
# alt+y
|
|
||||||
# Run:
|
|
||||||
# In admin powershell Terminal:
|
|
||||||
# iwr https://git.thecoven.info/PrincessPi/general-scripts-and-system-ssssssetup/raw/branch/main/Windows-Scripts/windows-repair.ps1?nocache=$(Get-Random) -OutFile $env:TEMP\windows-repair-temp.ps1; powershell -nop -ep Bypass -File $env:TEMP\windows-repair-temp.ps1
|
|
||||||
|
|
||||||
# check if hasadmin rights, if notm run script in new terminal, clopsing old
|
|
||||||
## if not, carry on
|
|
||||||
if (-not ([Security.Principal.WindowsIdentity]::GetCurrent().Groups -contains 'S-1-5-32-544')) {
|
|
||||||
# launch tghis script int new window after promopting for admin
|
|
||||||
Start-Process -FilePath 'powershell' -Verb RunAs -ArgumentList "-ExecutionPolicy Bypass -File $PSCommandPath"
|
|
||||||
|
|
||||||
# CLOSE previous terminal with success
|
|
||||||
exit 0
|
|
||||||
} else {
|
|
||||||
Clear-Host # clear window
|
|
||||||
|
|
||||||
# ascii art
|
|
||||||
Write-Host -ForegroundColor Magenta @'
|
|
||||||
.. .....
|
|
||||||
....------..
|
|
||||||
..:--------.. .......
|
|
||||||
..----------.. ....---..
|
|
||||||
...---------=------::....:----:..
|
|
||||||
..-----=+**************=-----:...
|
|
||||||
.----+****************=-----...
|
|
||||||
.--=****************=-----=**+:::--:....
|
|
||||||
.-=#*********##**++=---====++**+-----:.
|
|
||||||
..:==********#=.+@%-==++===++===++*=----...
|
|
||||||
.:=::******%%+-::=++====+==++====+**=--...
|
|
||||||
.:+..+*****--@===-:-%--====-=+====+*#=:..
|
|
||||||
.-=.-****#=.#+===--=+===----======+*+..
|
|
||||||
.:=:+****#@#+=====-**-----*+====++**:.
|
|
||||||
.. .=****=--======-..%-----%+==++***+-..
|
|
||||||
..=++***+-.----======..*-----#+==+***#%#+..
|
|
||||||
.. .:-..---=====--------=-+==+**-@*. ............::::::....
|
|
||||||
..=:..--===+-:-------*%+==*+#%**=. .....:-------------------------:.
|
|
||||||
..............-:..--===+-..:-------+==+==.:... ...:----------------------------::.
|
|
||||||
......:----------::=:...--==+--:.:-------+==+=:.... ....--------------------------:.....
|
|
||||||
..:::----------------=-::.:--===---:.:------=--:.... ...:---------------------------...
|
|
||||||
..:------------------=--:..:--=+=--------::.:+-..... ...------------------------------..
|
|
||||||
...:-----------------:....----==-------:...=%*.......:::--------------------------------:..
|
|
||||||
...--------------:+......---------------:+%%#.----------------------------:.......-----:..
|
|
||||||
.:----===-------:-.. .:--------------*%%%%=--------------========------:.......-------:...
|
|
||||||
..-:.:------------....-.=---------=#%%%%##%------------=-----------------------------------..
|
|
||||||
.:--:....:--------:##*=:.-------=#%%%%%%#%+-----------=-------------------------------------:
|
|
||||||
..:-----------------::*%%#-------=###%%%%##=--------------------------------------:............
|
|
||||||
..:-------------------:.-#%%##+==+%%%%%%#%+------------------------...:::--------------::::::..
|
|
||||||
...:----------------------..-#%#%%%%%%%%*+#%=-------------------------=-:....:----------------:...
|
|
||||||
--------------------------:.-#%%%%%%%%+#@%%%--------------------------=++=-::---------------:...
|
|
||||||
---------------------------...+%%%%%%%#%%%%#---------------------------------------------:....
|
|
||||||
............------.....----:....-#%%%%%%%*=------------------------------::+=---------.......
|
|
||||||
..:-... ....-----.. ....-=-------------------------------------.=*+=.......
|
|
||||||
..---:....:-----:.......:--------------------------:-------------==+=-......
|
|
||||||
.:-------------..........:---------------------------..:-------------==..........
|
|
||||||
..-------------:... ...--------:...----------------....:-----------==-...........
|
|
||||||
..:----==------:..-.... ..--------:...:---------------.....:----------=+-.....
|
|
||||||
..------==+=++==-..+--:. .:--------.....-----------=*%=.. ..----------=+=......
|
|
||||||
....------------........:... ..:--------.....-------+#%%#@%.. ...----------=+=......
|
|
||||||
....---------===:............... .:----=+*#=. ..--+#**+%@@@#%+. ..:-:..=----=*=:.....
|
|
||||||
:............:=::+=:--:=.=-.::=... ..*@*-+%@@@:.....-@@#%@*#@@@#%:.. ..-:..---:-#**+-.........
|
|
||||||
.. ...::::....::-.:.::-.. ..*%:..*@@@*.. ..-%#%@@+%@@@@=.. ...::.=#=..-%*++=:... ...
|
|
||||||
...... .......... ..**...*#=*%:. .-*#@%+#%@@@@+... ..*%@%+...+%+=*+=-...
|
|
||||||
..*#:.-#+..+-. ..-*#**%%*%@@%=.. ..-%@@*:..+@%=:+**+=:..
|
|
||||||
..*@#*%%=..==. .-*%@#%@##@@@#-. ...#@@%*-=%@@#:..-=++=-
|
|
||||||
.:#@*-:++..==. .=#%@%*@@*%*=+*:....:.+@*::+%@@@%=......-*
|
|
||||||
.-%+...=%##%-. .+@*@%*%@##*-:*+..:-==*@=..:#@+:=*:.......
|
|
||||||
.:*#:..:*@@@%:. .-%@*%@#*%*#=..-%-....:+#=-.:#%-.:+-.......
|
|
||||||
.+@#=.-*@@@@*.. ....-%@@@@@@=..+%*.. .-%--=+#%-.:*-. ....
|
|
||||||
.-=++++++++=... .:***+++==::::... .-%#=-*#%#**#-.
|
|
||||||
..............
|
|
||||||
'@
|
|
||||||
# vars
|
|
||||||
$LogDir = "$env:USERPROFILE\Downloads\Repair-Log-$((Get-Date).ToString('yyyy-MM-dd-HHmm'))" # path to new log Dir
|
|
||||||
$MainLog = "$LogDir\main.log" # error log file
|
|
||||||
|
|
||||||
Write-Host "FIXING WINDOWS FULL PRINCESS PI STYLE (THIS WILL TAKE MANY HOURS AND REBOOT MORE THAN ONCE, SLOWLY)`n" -ForegroundColor Magenta
|
|
||||||
|
|
||||||
Write-Output "Creating Log Dir at $LogDir 1/21 at $((Get-Date).ToString('yyyy-MM-dd-HHmm'))"
|
|
||||||
mkdir "$LogDir" > $null 2> $null # create log dir
|
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm')) Initialize Log File $LogFile 3/21`n`tFollow Log File in Another Terminal With`n`t`t``Get-Content `"$MainLog`" -Wait -Tail 50``"
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))" >> "$MainLog"
|
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tOpening Log Dir 2/21" | Tee-Object -FilePath "$MainLog" -Append
|
|
||||||
explorer.exe "$LogDir"
|
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tAborting Any Scheduled Shutdowns 4/21" | Tee-Object -FilePath "$MainLog" -Append
|
|
||||||
shutdown.exe /a > $null 2>> "$MainLog" # cmd abort scheduled shutdowns
|
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`t`Creating Log Dir at $LogDir 5/21" | Tee-Object -FilePath "$MainLog" -Append
|
|
||||||
New-Item -Path "$LogDir" -ItemType Directory > $null 2>> "$MainLog" # create log dir
|
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tGenerating and Displaying Comprehensive Stability Report 6/21" | Tee-Object -FilePath "$MainLog" -Append
|
|
||||||
Start-Process "perfmon.exe" -ArgumentList "/report" -Wait # running report
|
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tGenerating and Displaying Stability History Report 7/21" | Tee-Object -FilePath "$MainLog" -Append
|
|
||||||
Start-Process "perfmon.exe" -ArgumentList "/rel" -Wait # historical report
|
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tClearning DNS Cache 8/21" | Tee-Object -FilePath "$MainLog" -Append
|
|
||||||
ipconfig.exe /flushsdns > $null 2>> "$MainLog" # flush dns cache
|
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tClearing ARP Table 9/21" | Tee-Object -FilePath "$MainLog" -Append
|
|
||||||
Remove-NetNeighbor -Confirm:$false > $null 2>> "$MainLog" # flush ARP Table
|
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tClearing ALL Samba Credentials 10/21" | Tee-Object -FilePath "$MainLog" -Append
|
|
||||||
net.exe use * /delete /y > $null 2>> "$MainLog" # nuke all samba creds automagically
|
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tReleasing and Renweing DHCP 11/21" | Tee-Object -FilePath "$MainLog" -Append
|
|
||||||
# release and renew dhcp
|
|
||||||
ipconfig.exe /release > $null 2>> "$MainLog"
|
|
||||||
ipconfig.exe /renew > $null 2>> "$MainLog"
|
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tGetting Control of Windows Update 12/21" | Tee-Object -FilePath "$MainLog" -Append
|
|
||||||
Install-Module -Name PSWindowsUpdate -Force > $null 2>> "$MainLog"
|
|
||||||
Import-Module PSWindowsUpdate
|
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tUpdating Windows 13/21" | Tee-Object -FilePath "$MainLog" -Append
|
|
||||||
Get-WindowsUpdate -AcceptAll -Install -IgnoreReboot > $null 2>> "$MainLog"
|
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tUpdating Malware Signatures 14/21" | Tee-Object -FilePath "$MainLog" -Append
|
|
||||||
Update-MpSignature 2>> "$MainLog" # update windows defender malware siggs
|
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tRunning FULL Windows Defender SCAN 15/21" | Tee-Object -FilePath "$MainLog" -Append
|
|
||||||
Start-MpScan -ScanType FullScan 2>> "$MainLog" # full windows defender scan
|
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tRunning DISM Online Image Cleanup 16/21" | Tee-Object -FilePath "$MainLog" -Append
|
|
||||||
DISM.exe /Online /Cleanup-Image /RestoreHealth 2>> "$MainLog" # online check for bad files
|
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tRunning System File Checker 17/21" | Tee-Object -FilePath "$MainLog" -Append
|
|
||||||
SFC.exe /scannow 2>> "$MainLog" # older check for bad files
|
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tScheduling Essential File Check on Next Boot 18/21" | Tee-Object -FilePath "$MainLog" -Append
|
|
||||||
SFC.exe /scanonce 2>> "$MainLog" # check essential files on next boot
|
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tScheduling Offline chkdsk and Repair of C: 19/21" | Tee-Object -FilePath "$MainLog" -Append
|
|
||||||
Write-Output y | chkdsk.exe /f /r C: > $null 2>> "$MainLog" # cmd checks C drive after reboot to waste time and fix errors (noninteractive via y ffuckery)
|
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tScheduling Offline Memory Test at Next Boot 20/21" | Tee-Object -FilePath "$MainLog" -Append
|
|
||||||
mdsched.exe /s 2>> "$MainLog" # schedule offline memtest (noninteractive)
|
|
||||||
|
|
||||||
Write-Output "$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`tScheduling Windows Defender Offline Scan 21/21`n`tMAY REBOOT UNEXPECTEDLY`n" | Tee-Object -FilePath "$MainLog" -Append
|
|
||||||
Start-MpWDOScan 2>> "$MainLog" # powershell starts Windows Defender Offline Scan after reboot
|
|
||||||
|
|
||||||
Write-Host "`nRebooting in 5 Minutes MAX Probably Sooner`n" -ForegroundColor Magenta
|
|
||||||
shutdown.exe /r /t (60*5) # shutdown in 5 minutes as failsafe
|
|
||||||
|
|
||||||
Write-Output "`n$((Get-Date).ToString('yyyy-MM-dd-HHmm'))`n`nDONEsiez :3~`n" | Tee-Object -FilePath "$MainLog" -Append
|
|
||||||
}
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
# CUSTOM STUFFS
|
|
||||||
# custom scripts https://github.com/PrincessPi3/general-scripts-and-system-ssssssetup
|
|
||||||
PATH="$PATH:/usr/share/customscripts"
|
|
||||||
|
|
||||||
# pico SDK https://github.com/raspberrypi/pico-sdk
|
|
||||||
export PICO_SDK_PATH='/home/kali/pico-sdk'
|
|
||||||
|
|
||||||
# esp-install-custom https://github.com/PrincessPi3/esp-install-custom
|
|
||||||
alias get_idf='. /home/princesspi/esp/esp-idf/export.sh'
|
|
||||||
alias run_esp_reinstall='git -C /home/princesspi/esp/esp-install-custom pull;echo -e "\nOld Version:";tail -1 /home/princesspi/esp/version-data.log;echo -e "\n";bash /home/princesspi/esp/esp-install-custom/reinstall-esp-idf.sh'
|
|
||||||
alias esp_monitor='tail -n 75 -f /home/princesspi/esp/install.log'
|
|
||||||
alias esp_logs='less /home/princesspi/esp/version-data.log;less /home/princesspi/esp/install.log'
|
|
||||||
export ESPIDF_INSTALLDIR="/home/princesspi/esp"
|
|
||||||
|
|
||||||
# pyenv https://github.com/pyenv/pyenv
|
|
||||||
export PYENV_ROOT="$HOME/.pyenv"
|
|
||||||
[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"
|
|
||||||
eval "$(pyenv init - zsh)"
|
|
||||||
@@ -1,19 +0,0 @@
|
|||||||
# Errata-Oneliners
|
|
||||||
leave self a warning not to fuck with shit
|
|
||||||
```bash
|
|
||||||
clear && echo -e "\n\n\n\n\n\n\n\n\n\n\n\n\n\e[32mFOOOKN 1TB DUMP IN PROGRESS DONT FUCK WITH ANYTHNG\e[0m\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n"
|
|
||||||
```
|
|
||||||
watch file growth based on partial names
|
|
||||||
```bash
|
|
||||||
file_tag=Kali-Pi5-Full-Configured-Working-1TB && dump_pid=1717053 && watch -n 300 "echo -e '\n\n\n\e[32mFOOOKN 1TB DUMP IN PROGRESS DONT FUCK WITH ANYTHNG\e[0m\n\n\n' && ls -lAh *${file_tag}* && echo && free -h && echo && uptime && echo && ps -p $dump_pid -o etime"
|
|
||||||
```
|
|
||||||
**submit sample to virustotal**
|
|
||||||
```bash
|
|
||||||
# in ~/.bashrc
|
|
||||||
export VIRUSTOTAL_API_KEY="<mah key>"
|
|
||||||
|
|
||||||
# in cli
|
|
||||||
sha256dsum SAMPLE.zip # get sha256 to look up on the site
|
|
||||||
curl -X POST -H "X-ApiKey: $VIRUSTOTAL_API_KEY" -F "file=@$PWD/SAMPLE.zip" https://www.virustotal.com/api/v3/files
|
|
||||||
# then look up file by sha256 checksum on the site
|
|
||||||
```
|
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
subnet="10.0.0.0/24"
|
|
||||||
delay=60
|
|
||||||
count=1
|
|
||||||
start_time=$(date +%s)
|
|
||||||
|
|
||||||
while true; do
|
|
||||||
current_time=$(date +%s)
|
|
||||||
elapsed_time=$((current_time - start_time))
|
|
||||||
elapsed_minutes=$((elapsed_time / 60))
|
|
||||||
echo -e "\ndate $(date) elapsed_mins $elapsed_minutes count $count delay $delay subnet $subnet\n"
|
|
||||||
nmap -sV -O -p22 $subnet -oG - | grep -n '22/open/tcp' # fast on port 22 only with ping sweep
|
|
||||||
# nmap -sV -O -Pn -p22 $subnet -oG - | grep -n '22/open/tcp' # pingless search
|
|
||||||
# nmap -sV -O $subnet -oG - | grep -n '22/open/tcp' # lots of ports search
|
|
||||||
# nmap -sV -O -Pn $subnet -oG - | grep -n '22/open/tcp' # all ports search, pingless, slow
|
|
||||||
# sleep $delay
|
|
||||||
count=$((count + 1))
|
|
||||||
done
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
domain=kasm.h.acker.is
|
|
||||||
local_port=8443
|
|
||||||
swap_size_gib=6
|
|
||||||
sudo apt update
|
|
||||||
sudo apt dist-upgrade -y
|
|
||||||
sudo fallocate -l ${swap_size_gib}g /mnt/${swap_size_gib}GiB.swap
|
|
||||||
sudo chmod 600 /mnt/${swap_size_gib}GiB.swap
|
|
||||||
sudo mkswap /mnt/${swap_size_gib}GiB.swap
|
|
||||||
sudo swapon /mnt/${swap_size_gib}GiB.swap
|
|
||||||
echo "/mnt/${swap_size_gib}GiB.swap swap swap defaults 0 0" | sudo tee -a /etc/fstab
|
|
||||||
cd /tmp
|
|
||||||
curl -O https://kasm-static-content.s3.amazonaws.com/kasm_release_1.19.0-latest.tar.gz
|
|
||||||
tar -xf kasm_release*.tar.gz
|
|
||||||
sudo bash kasm_release/install.sh -L $local_port
|
|
||||||
sudo apt update
|
|
||||||
sudo apt install nginx certbot python3-certbot-nginx -y
|
|
||||||
sudo certbot certonly --nginx -d $domain
|
|
||||||
sudo cat << 'EOF' > /etc/nginx/sites-available/$domain
|
|
||||||
server {
|
|
||||||
listen 443 ssl;
|
|
||||||
server_name $domain;
|
|
||||||
ssl_certificate /etc/letsencrypt/live/$domain/fullchain.pem;
|
|
||||||
ssl_certificate_key /etc/letsencrypt/live/$domain/privkey.pem;
|
|
||||||
location / {
|
|
||||||
# WebSocket Support
|
|
||||||
proxy_set_header Upgrade $http_upgrade;
|
|
||||||
proxy_set_header Connection "upgrade";
|
|
||||||
|
|
||||||
# Host and X headers
|
|
||||||
proxy_set_header Host $host;
|
|
||||||
proxy_set_header X-Real-IP $remote_addr;
|
|
||||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
|
||||||
proxy_set_header X-Forwarded-Proto $scheme;
|
|
||||||
|
|
||||||
# Should match the listening port of this proxy
|
|
||||||
proxy_set_header X-Forwarded-Port 443;
|
|
||||||
|
|
||||||
# Connectivity Options
|
|
||||||
proxy_http_version 1.1;
|
|
||||||
proxy_read_timeout 1800s;
|
|
||||||
proxy_send_timeout 1800s;
|
|
||||||
proxy_connect_timeout 1800s;
|
|
||||||
proxy_buffering off;
|
|
||||||
|
|
||||||
# Allow large requests to support file uploads to sessions
|
|
||||||
client_max_body_size 10M;
|
|
||||||
|
|
||||||
# Proxy to Kasm Workspaces running locally on $local_port using ssl
|
|
||||||
proxy_pass https://127.0.0.1:$local_port;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
sudo ln -s /etc/nginx/sites-available/$domain /etc/nginx/sites-enabled/$domain
|
|
||||||
sudo nginx -t
|
|
||||||
sudo systemctl restart nginx
|
|
||||||
sudo docker restart kasm_api
|
|
||||||
sudo shutdown -r +7
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
checkcode () {
|
|
||||||
if [ -z "$1" ]; then
|
|
||||||
echo "Error! Use Checkcode like checkcode \$?" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
retcode=$1
|
|
||||||
|
|
||||||
if [ ! $retcode -eq 0 ]; then
|
|
||||||
printf " \033[0;31mError Code: $retcode\033[0m\n"
|
|
||||||
else
|
|
||||||
printf " \033[0;32mOK!\033[0m\n"
|
|
||||||
fi
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
echo -e "\n\033[0;31mCRASHING DOCKER AND EVERYTHING IN IT WITH NO SURVIVORS\033[0m\n"
|
|
||||||
|
|
||||||
echo -n "1/9: Stopping Docker... "
|
|
||||||
sudo docker stop $(sudo docker ps -a -q) >/dev/null 2>&1
|
|
||||||
checkcode $?
|
|
||||||
|
|
||||||
echo -n "2/9 Removing Docker Containers..."
|
|
||||||
sudo docker rm -v $(sudo docker ps -a -q) >/dev/null 2>&1
|
|
||||||
checkcode $?
|
|
||||||
|
|
||||||
echo -n "3/9 Removing Docker Images..."
|
|
||||||
sudo docker rmi $(sudo docker images -a -q) >/dev/null 2>&1
|
|
||||||
checkcode $?
|
|
||||||
|
|
||||||
echo -n "4/9 Removing Docker Volumes..."
|
|
||||||
sudo docker volume rm $(sudo docker volume ls -q) >/dev/null 2>&1
|
|
||||||
checkcode $?
|
|
||||||
|
|
||||||
echo -n "5/9 Removing Docker Networks..."
|
|
||||||
sudo docker network rm $(sudo docker network ls -q) >/dev/null 2>&1
|
|
||||||
checkcode $?
|
|
||||||
|
|
||||||
echo -n "6/9 Stopping Docker Daemon..."
|
|
||||||
sudo systemctl stop docker >/dev/null 2>&1
|
|
||||||
checkcode $?
|
|
||||||
|
|
||||||
echo -n "7/9 Disabling Docker Daemon Start At Boot..."
|
|
||||||
sudo systemctl disable docker >/dev/null 2>&1
|
|
||||||
checkcode $?
|
|
||||||
|
|
||||||
echo -n "8/9 Updating Package Repos..."
|
|
||||||
sudo apt update >/dev/null 2>&1
|
|
||||||
checkcode $?
|
|
||||||
|
|
||||||
echo -n "9/9 Removing and Purging docker.io and docker-compose"
|
|
||||||
sudo apt purge docker.io docker-compose -y >/dev/null 2>&1
|
|
||||||
checkcode $?
|
|
||||||
|
|
||||||
echo -e "\n\n\033[0;32mdonesies docker gone and purged\033[0m\n\n"
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
username=princesspi
|
|
||||||
echo "UNFUCK HOMEDIR PERMS"
|
|
||||||
sudo chown -R $username:$username /home/$username 2>/dev/null
|
|
||||||
sudo chmod 755 /home/$username 2>/dev/null
|
|
||||||
sudo chmod 700 /home/$username/.ssh 2>/dev/null
|
|
||||||
sudo chmod 600 /home/$username/.ssh/id_rsa 2>/dev/null
|
|
||||||
sudo chmod 644 /home/$username/.ssh/id_rsa.pub 2>/dev/null
|
|
||||||
sudo chmod 600 /home/$username/.ssh/authorized_keys 2>/dev/null
|
|
||||||
sudo chmod 600 /home/$username/.ssh/config 2>/dev/null
|
|
||||||
sudo chmod 644 /home/$username/.ssh/known_hosts 2>/dev/null
|
|
||||||
sudo chmod 644 /home/$username/.ssh/id_ed25519.pub 2>/dev/null
|
|
||||||
sudo chmod 600 /home/$username/.ssh/id_ed25519 2>/dev/null
|
|
||||||
@@ -1,42 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
[ "root" != "$USER" ] && exec sudo $0 "$@"
|
|
||||||
#usage sudo sh add_site_apache2.sh 192.168.1.1 example.com
|
|
||||||
#note: the web server will go down for the duration this script is running
|
|
||||||
#set needed A records to domain DNS before beginning
|
|
||||||
#bind IP desired before beginning
|
|
||||||
|
|
||||||
IP=$1
|
|
||||||
DOMAIN=$2
|
|
||||||
|
|
||||||
#stop apache
|
|
||||||
systemctl stop apache2
|
|
||||||
|
|
||||||
#cert get interface
|
|
||||||
certbot certonly
|
|
||||||
|
|
||||||
mkdir /var/www/$DOMAIN
|
|
||||||
echo "<h1>its live</h1>" > /var/www/$DOMAIN/index.html
|
|
||||||
|
|
||||||
#make and place config file
|
|
||||||
cat << EOF | echo > /etc/apache2/sites-available/{$DOMAIN}.config
|
|
||||||
<VirtualHost {$IP}:443>
|
|
||||||
DocumentRoot /var/www/{$DOMAIN}
|
|
||||||
ServerName $DOMAIN
|
|
||||||
SSLEngine on
|
|
||||||
SSLCertificateFile /etc/letsencrypt/live/{$DOMAIN}/fullchain.pem
|
|
||||||
SSLCertificateKeyFile /etc/letsencrypt/live/{$DOMAIN}/privkey.pem
|
|
||||||
SSLProtocol all -SSLv2 -SSLv3
|
|
||||||
SSLHonorCipherOrder on
|
|
||||||
SSLCipherSuite "HIGH:!aNULL:!MD5:!3DES:!CAMELLIA:!AES128"
|
|
||||||
SSLProtocol all -SSLv2 -SSLv3 -TLSv1 -TLSv1.1
|
|
||||||
</VirtualHost>
|
|
||||||
|
|
||||||
<VirtualHost {$IP}:80>
|
|
||||||
ServerName $DOMAIN
|
|
||||||
Redirect permanent / https://{$DOMAIN}/
|
|
||||||
</VirtualHost>
|
|
||||||
EOF
|
|
||||||
|
|
||||||
a2ensite $DOMAIN
|
|
||||||
sh fix_permissions.sh
|
|
||||||
systemctl start apache2
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# usage:
|
|
||||||
# add_user_ssh.sh "$USER" "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIP2D+9oYQlTnu1zeVi2gHfTKE7+DDWiu1EibXNwB9g72 princesspi@proton.me"
|
|
||||||
|
|
||||||
[ "root" != "$USER" ] && exec sudo $0 "$@"
|
|
||||||
KEY="$2"
|
|
||||||
if [ -d "/home/$1/.ssh" ]; then
|
|
||||||
echo "$KEY" >> "/home/$1/.ssh/authorized_keys"
|
|
||||||
else
|
|
||||||
mkdir "/home/$1/.ssh"
|
|
||||||
echo "$KEY" >> "/home/$1/.ssh/authorized_keys"
|
|
||||||
fi
|
|
||||||
chmod 700 "/home/$1/.ssh"
|
|
||||||
chmod 600 "/home/$1/.ssh/authorized_keys"
|
|
||||||
chown -R $1:$1 "/home/$1/.ssh"
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
polygen /usr/share/customscripts/annoy_the_fuck_out_of_commit_message_nerds.grm | tr -d '\n'
|
|
||||||
@@ -1,17 +0,0 @@
|
|||||||
I ::= "title: Annoy the Fuck Out of Commit Message Nerds\n"
|
|
||||||
^ "author: Princess Pi <princesspi@proton.me>\n"
|
|
||||||
^ "language: english\n"
|
|
||||||
^ "topic: annoyances\n"
|
|
||||||
^ "audience: people who like to fuck off git purists :glimglamgrin:\n"
|
|
||||||
^ "created: 2025-12-20\n"
|
|
||||||
;
|
|
||||||
|
|
||||||
S ::= Adjective Noun Chaos Operation;
|
|
||||||
|
|
||||||
Adjective ::= "Async" | "Blocking" | "Brittle" | "Cached" | "Concurrent" | "Deprecated" | "Distributed" | "Flaky" | "Immutable" | "Leaky" | "Monolithic" | "Mutable" | "Racey" | "Recursive" | "Redundant" | "Sandboxed" | "Stale" | "Thread-Safe" | "Undefined" | "Unoptimized";
|
|
||||||
|
|
||||||
Noun ::= "api" | "build" | "cache" | "compiler" | "container" | "daemon" | "database" | "endpoint" | "function" | "heap" | "kernel" | "microservice" | "mutex" | "pipeline" | "process" | "queue" | "runtime" | "scheduler" | "stack" | "thread";
|
|
||||||
|
|
||||||
Chaos ::= "overflow" | "deadlock" | "panic" | "segfault" | "bottleneck" | "regression" | "refactor" | "hotfix" | "workaround" | "incident";
|
|
||||||
|
|
||||||
Operation ::= "added" | "removed" | "updated" | "fixed" | "corrected" | "tweaked" | "optimized" | "deleted" | "appended" | "concatanated" | "repaired" | "simplified" | "reverted" | "approved" | "rejected";
|
|
||||||
Binary file not shown.
@@ -1,61 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# PACKAGES NEEDDED: argon2, cracklib-check, xxd?
|
|
||||||
|
|
||||||
time_cost=3 # time cost (iterations)
|
|
||||||
memory_cost=16 # 2^n KiB ex 16 = 64 MiB (mem usage)
|
|
||||||
paralellization_cost=1 # threads
|
|
||||||
salt_min_length=40
|
|
||||||
|
|
||||||
read -p "Input File to prove authorship of:" file
|
|
||||||
if [ ! -f "$file" ]; then
|
|
||||||
echo "$file not found!"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "File: OK"
|
|
||||||
file=$(realpath $file)
|
|
||||||
fi
|
|
||||||
|
|
||||||
# gather salt
|
|
||||||
read -s -p "Input Secret Salt" salt1
|
|
||||||
read -s -p "Re-Enter Secret Salt" salt2
|
|
||||||
## Sanity check the salt
|
|
||||||
### not empty
|
|
||||||
if [ -z "$salt1" -o -z "$salt2" ]; then
|
|
||||||
echo "Input salts can NOT be blank!"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "Salt Supplied: OK"
|
|
||||||
fi
|
|
||||||
### match
|
|
||||||
if [[ "$salt1" != "$salt2" ]]; then
|
|
||||||
echo "Salts DO NOT MATCH"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "Salts match: OK"
|
|
||||||
fi
|
|
||||||
### length
|
|
||||||
salt_length=${#salt1} # salt len
|
|
||||||
if [[ $salt_length -le $salt_min_length ]]; then
|
|
||||||
echo "Salt MUST be $salt_min_length characters or longer!"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo "Salt Length: OK"
|
|
||||||
fi
|
|
||||||
### salt safety and complexity
|
|
||||||
complexity_check=$(echo -n "$salt1" | cracklib-check)
|
|
||||||
if grep -q 'OK' <<< "$complexity_check"; then
|
|
||||||
echo "Complexity: OK"
|
|
||||||
else
|
|
||||||
echo "Salt NOT Complex enough!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
argon2 "$salt1" -id -t $time_cost -m $memory_cost -p $paralellization_cost -e
|
|
||||||
< "$file"
|
|
||||||
|
|
||||||
## cleanup
|
|
||||||
unset $salt1
|
|
||||||
unset $salt2
|
|
||||||
unset $salt_length
|
|
||||||
echo "DONE"
|
|
||||||
exit 0
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
[ "root" != "$USER" ] && exec sudo $0 "$@"
|
|
||||||
LOCK=/var/lock/backups.lock
|
|
||||||
if [ ! -f $LOCK ]; then
|
|
||||||
echo "lock" > $LOCK
|
|
||||||
rsync -rzvvb --backup-dir=_old_ --suffix=$(date+_%F-%T) --update --times -e ssh /home/ <username>@<server>:~/backups/home
|
|
||||||
rm -f $LOCK
|
|
||||||
fi
|
|
||||||
@@ -1,103 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# todo:
|
|
||||||
## seperate out values
|
|
||||||
### x compression ratios
|
|
||||||
### x avg cpu and memory load (free and uptime?)
|
|
||||||
### x time to complete
|
|
||||||
### parse apart before and after mem values and display deltas
|
|
||||||
|
|
||||||
log_file="$(date +"%Y-%m-%d-%H%M-%S")_compressor_battle.log" # file safe sortable timestamp
|
|
||||||
# exec 2> >(tee -a "$log_file" >&2) # output all errs to terminal and log file
|
|
||||||
echo > "$log_file" # clean and initialize log file
|
|
||||||
|
|
||||||
# SUM TEXT COLORS
|
|
||||||
RED='\e[31m'
|
|
||||||
GREEN='\e[1;32m'
|
|
||||||
RESET='\033[0m'
|
|
||||||
|
|
||||||
echo -e "\n${GREEN}Battle of the img compressions${RESET}\n"
|
|
||||||
|
|
||||||
# first, delete any outstanding logs or compressed files
|
|
||||||
if [[ "$2" =~ nuke ]]; then
|
|
||||||
echo -e "${GREEN}Deleting old Files because NUKE was specified${RESET}"
|
|
||||||
rm -f *.log *.zip *.xz *.tar *.gz *.7z
|
|
||||||
echo -e "${GREEN}Done!${RESET}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -f "$1" ]; then
|
|
||||||
echo -e "\n\n\n${RED}No image File Specified, exiting${RESET}"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo -e "${GREEN}OK!${RESET} $1 is a file and it exists"
|
|
||||||
img_file="$1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# xz
|
|
||||||
echo -e "\n${GREEN}Starting test with xz${RESET}\n"
|
|
||||||
xz_start=$(date +%s)
|
|
||||||
xz -k -v "$img_file"
|
|
||||||
xz_end=$(date +%s)
|
|
||||||
xz_time=$(($xz_end - $xz_start))
|
|
||||||
xz_img_size=$(du --bytes "$img_file" | awk '{print $1}')
|
|
||||||
xz_compressed_size=$(du --bytes "$img_file.xz" | awk '{print $1}')
|
|
||||||
xz_compression_ratio=$(($xz_compressed_size / $xz_img_size))
|
|
||||||
echo -e "\n\nxz_img_size: $xz_img_size xz_compressed_size: $xz_compressed_size xz_compression_ratio: $xz_compression_ratio seconds: $xz_time start: $xz_start end: $xz_end\n\n"
|
|
||||||
# echo -e "Size of file $img_file is: $(du -h $img_file | awk '{print $1}') or $(du --bytes $img_file | awk '{print $1}') bytes taking $xz_time seconds to complete" | tee -a "$log_file"
|
|
||||||
# echo -e "Size of the compressed file is $(du -h $img_file.xz | awk '{print $1}') or $(du --bytes $img_file.xz | awk '{print $1}') bytes" | tee -a "$log_file"
|
|
||||||
|
|
||||||
# gzip
|
|
||||||
echo -e "\n${GREEN}Starting test with gzip${RESET}"
|
|
||||||
gz_start=$(date +%s)
|
|
||||||
gzip -k -v "$img_file"
|
|
||||||
gz_retcode=$?
|
|
||||||
gz_end=$(date +%s)
|
|
||||||
gz_time=$(($gz_end - $gz_start))
|
|
||||||
gz_img_size=$(du --bytes "$img_file" | awk '{print $1}')
|
|
||||||
gz_compressed_size=$(du --bytes "$img_file.gz" | awk '{print $1}')
|
|
||||||
gz_compression_ratio=$(($gz_img_size / $gz_compressed_size))
|
|
||||||
echo -e "\n\n${GREEN}GZ Finished!\n\tgz_img_size: $gz_img_size\n\tgz_compressed_size: $gz_compressed_size\n\tgz_compression_ratio: $gz_compression_ratio\n\tseconds: $gz_time\n\tstart: $gz_start\n\tend: $gz_end \n\tretcode: $gz_retcode${RESET}\n\n"
|
|
||||||
# echo -e "Size of file $img_file is: $(du -h $img_file | awk '{print $1}') bytes taking $gz_time seconds to complete" | tee -a "$log_file"
|
|
||||||
# echo -e "Size of the compressed file is $(du -h $img_file.gz | awk '{print $1}') or $(du --bytes $img_file.xz | awk '{print $1}') bytes" | tee -a "$log_file"
|
|
||||||
|
|
||||||
# tar
|
|
||||||
echo -e "\n${GREEN}Starting test with tar${RESET}\n"
|
|
||||||
tar_start=$(date +%s)
|
|
||||||
tar -cvf "$img_file.tar" "$img_file"
|
|
||||||
tar_retcode=$?
|
|
||||||
tar_end=$(date +%s)
|
|
||||||
tar_time=$(($tar_end - $tar_start))
|
|
||||||
tar_img_size=$(du --bytes "$img_file" | awk '{print $1}')
|
|
||||||
tar_compressed_size=$(du --bytes "$img_file.tar" | awk '{print $1}')
|
|
||||||
tar_compression_ratio=$(($tar_img_size / $tar_compressed_size))
|
|
||||||
echo -e "\n\n${GREEN}TAR Finished!\n\ttar_img_size: $tar_img_size\n\ttar_compressed_size: $tar_compressed_size\n\ttar_compression_ratio: $tar_compression_ratio\n\tseconds: $tar_time\n\tstart: $tar_start\n\tend: $tar_end \n\tretcode: $tar_retcode${RESET}\n\n"
|
|
||||||
# echo -e "Size of file $img_file is: $(du -h $img_file | awk '{print $1}') or $(du --bytes $img_file | awk '{print $1}') bytes taking $tar_time seconds to complete" | tee -a "$log_file"
|
|
||||||
# echo -e "Size of the compressed file is $(du -h $img_file.tar | awk '{print $1}') or $(du --bytes $img_file.tar | awk '{print $1}') bytes" | tee -a "$log_file"
|
|
||||||
|
|
||||||
# 7z
|
|
||||||
echo -e "\n${GREEN}Starting test with 7z${RESET}"
|
|
||||||
sevenz_start="$(date +%s)"
|
|
||||||
7z a "$img_file.7z" "$img_file"
|
|
||||||
sevenz_end=$(date +%s)
|
|
||||||
sevevnz_time=$(($sevenz_end - $sevenz_start))
|
|
||||||
seven_img_size=$(du --bytes "$img_file" | awk '{print $1}')
|
|
||||||
seven_compressed_size=$(du --bytes "$img_file.7z" | awk '{print $1}')
|
|
||||||
seven_compression_ratio=$(($sevem_img_size / $seven_compressed_size))
|
|
||||||
echo -e "\n\n${GREEN}7ZIP Finished!\n\tseven_img_size: $sevem_img_size\n\tseven_compressed_size: $seven_compressed_size\n\tseven_compression_ratio: $seven_compression_ratio\n\tseconds: $tar_time\n\tstart: $tar_start\n\tend: $tar_end \n\tretcode: $tar_retcode${RESET}\n\n"
|
|
||||||
# echo -e "Size of file $img_file is: $(du -h "$img_file" | awk '{print $1}') or $(du --bytes "$img_file" | awk '{print $1}') bytes taking "$sevenz_time" seconds to complete" | tee -a "$log_file"
|
|
||||||
# echo -e "Size of the compressed file is $(du -h "$img_file.7z" | awk '{print $1}') or $(du --bytes "$img_file.7z" | awk '{print $1}') bytes" | tee -a "$log_file"
|
|
||||||
|
|
||||||
# zip
|
|
||||||
echo -e "\n${GREEN}Starting test with zip${RESET}\n"
|
|
||||||
zip_start=$(date +%s)
|
|
||||||
zip -v "$img_file.zip" "$img_file"
|
|
||||||
zip_retcode=$?
|
|
||||||
zip_end=$(date +%s)
|
|
||||||
zip_time=$(($zip_end - $zip_start))
|
|
||||||
zip_img_size=$(du --bytes "$img_file" | awk '{print $1}')
|
|
||||||
zip_compressed_size=$(du --bytes "$img_file.zip" | awk '{print $1}')
|
|
||||||
zip_compression_ratio=$(($zip_compressed_size / $zip_img_size))
|
|
||||||
echo -e "\n\n${GREEN}ZIP Finished!\n\tzip_img_size: $zip_img_size\n\tzip_compressed_size: $zip_compressed_size\n\tzip_compression_ratio: $zip_compression_ratio\n\tseconds elapssed: $zip_time\n\tstart: $zip_start\n\tend: $zip_end \n\tretcode: $zip_retcode${RESET}\n\n"
|
|
||||||
# echo -e "Size of file $img_file is: $(du -h $img_file | awk '{print $1}') or $(du --bytes $img_file | awk '{print $1}') bytes taking $zip_time seconds to complete" | tee -a "$log_file"
|
|
||||||
# echo -e "Size of the compressed file is $(du -h $img_file.zip | awk '{print $1}') or $(du --bytes $img_file.zip | awk '{print $1}') bytes" | tee -a "$log_file"
|
|
||||||
|
|
||||||
echo -e "\n\n\n${GREEN}DONE :3 nyaa~${RESET}\n\n"
|
|
||||||
@@ -1,57 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# usage
|
|
||||||
# binwalk.sh filename [default/opcodes/basicextract/compressionextract/opcodeextract
|
|
||||||
set -e
|
|
||||||
filename="$2"
|
|
||||||
unix_seconds=$(date +%s)
|
|
||||||
dir="binwalk-exracted-$filename-$unix_seconds"
|
|
||||||
log="binwalk-log-$filename-$unix_seconds.txt"
|
|
||||||
|
|
||||||
basic="Bf"
|
|
||||||
basicextract="Bef"
|
|
||||||
compressionextract="BeMXZCf"
|
|
||||||
opcodecompressextract="ABeMXZCf"
|
|
||||||
opcodeextract="ABeCf"
|
|
||||||
opcode="ABf"
|
|
||||||
|
|
||||||
basic_cmd="--signature"
|
|
||||||
basicextract_cmd="--signature --extract --directory=$dir"
|
|
||||||
compressionextract_cmd="--signature --extract --matryoshka --deflate --lzma --directory=$dir"
|
|
||||||
opcodecompressextract_cmd="--opcodes --signature --extract --matryoshka --deflate -lzma --directory=$dir"
|
|
||||||
opcodeextract_cmd="--opcodes --signature --extract --directory=$dir"
|
|
||||||
opcode_cmd="--opcodes --signature"
|
|
||||||
|
|
||||||
usage_string="Usage:\n\tbinwalk.sh <option> <file>\n\t\tb/d/basic/default\n\t\to/op/opcode/opcodes\n\t\tbe/eb/basicextract/extractbasic\n\t\tce/ec/compressionextract/extractcompression\n\t\tope/oce/oec/opcodecompressionextract\n\t\toe/eo/opcodeextract/extractopcode"
|
|
||||||
|
|
||||||
if [ "$1" == "o" -o "$1" == "opcode" -o "$1" == "opcodes" -o "$1" == "op" ]; then
|
|
||||||
tag="$opcode"
|
|
||||||
cmd="$opcode_cmd"
|
|
||||||
elif [ "$1" == "d" -o "$1" == "default" -o "$1" == "b" -o "$1" == "basic" ]; then
|
|
||||||
tag="$basic"
|
|
||||||
cmd="$basic_cmd"
|
|
||||||
elif [ "$1" == "be" -o "$1" == "basicextract" -o "$1" == "eb" -o "$1" == "extractbasic" ]; then
|
|
||||||
tag="$basicextract"
|
|
||||||
cmd="$basicextract_cmd"
|
|
||||||
elif [ "$1" == "ce" -o "$1" == "compressionextract" -o "$1" == "ec" -o "$1" == "extractcompression" ]; then
|
|
||||||
tag="$compressionextract"
|
|
||||||
cmd="$compressionextract_cmd"
|
|
||||||
elif [ "$1" == "oce" -o "$1" == "opcodecompressionextract" -o "$1" == "eoc" -o "$1" == "oec" ]; then
|
|
||||||
tag="$opcodecompressextract"
|
|
||||||
cmd="$opcodecompressextract_cmd"
|
|
||||||
elif [ "$1" == "oe" -o "$1" == "opcodeextract" -o "$1" == "eo" -o "$1" == "extractopcode" ]; then
|
|
||||||
tag="$opcodeextract_cmd"
|
|
||||||
cmd="$opcodeextract_cmd"
|
|
||||||
else
|
|
||||||
echo -e "$usage_string"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -e $cmd
|
|
||||||
|
|
||||||
if [ -z $2 ]; then
|
|
||||||
echo -e "$usage_string"
|
|
||||||
exit
|
|
||||||
fi
|
|
||||||
|
|
||||||
to_run="binwalk $cmd --log=$log"
|
|
||||||
eval($to_run)
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# set -e # die on any errpr because nmama didnt raise no bitch
|
|
||||||
# even includes error handling and sanity checks plus has help and even did tha retcodes :3
|
|
||||||
|
|
||||||
# happy naesms
|
|
||||||
provided_credential="$1"
|
|
||||||
openbadge_file="$2"
|
|
||||||
|
|
||||||
# halp string
|
|
||||||
halp_str="\nHelp:\n\tAbout:\n\t\tCheckBadge for verifying Openbadges\n\t\tPart of https://github.com/PrincessPi3/general-scripts-and-system-ssssssetup Files\n\tUsage:\n\t\tcheckbadge <string credential (email or phone number)> <string path to openbadge file>\n\t\tExample:\n\t\t\tcheckbadge 'my@email.com' mybadgefile.png\n\t Requires:\n\t\t* coreutils (sha256sum)\n\t\t* jq\n\t\t* exiftool"
|
|
||||||
|
|
||||||
# sum silliness so you can get help with retcode 0 with -h, -help, --help, --h, help, h, etc so lnog as the first arg starts with -?-?h (case insensitive) and arg two is empty
|
|
||||||
if [[ "$1" =~ ^[-]{0,2}[hH] ]]; then
|
|
||||||
if [ -z "$2" ]; then
|
|
||||||
echo -e "$halp_str"
|
|
||||||
exit 0
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
# maek sure da args are in place or print help and fail
|
|
||||||
if [ -z "$provided_credential" -o -z "$openbadge_file" ]; then
|
|
||||||
echo -e "\nERROR: must provide the credential and the file path"
|
|
||||||
echo -e "$halp_str"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# does fiel exist dipshit?
|
|
||||||
if [ ! -f "$openbadge_file" ]; then
|
|
||||||
echo -e "\nERROR: $openbadge_file not found"
|
|
||||||
echo -e "$halp_str"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# maek sure its an openbadges fiel
|
|
||||||
exiftool "$openbadge_file" | grep -q Openbadges
|
|
||||||
ret=$?
|
|
||||||
|
|
||||||
if [ $ret -ne 0 ]; then
|
|
||||||
echo -e "\nERROR: File $openbadgefile does not seem to be an Openbadge file or it has had its metadata stripped"
|
|
||||||
echo -e "$halp_str"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# gert da json out of da metadata fo da badger
|
|
||||||
openbadge_json=$(exiftool "$openbadge_file" | grep Openbadges | awk -F ': ' '{print $2}')
|
|
||||||
|
|
||||||
# get da values out of dat json
|
|
||||||
openbadge_url=$(echo $openbadge_json | jq -r '.badge')
|
|
||||||
openbadge_sha256=$(echo $openbadge_json | jq -r '.recipient.identity' | awk -F '$' '{print $2}')
|
|
||||||
openbadge_salt=$(echo $openbadge_json | jq -r '.recipient.salt')
|
|
||||||
openbadge_narrative=$(echo $openbadge_json | jq -r '.narrative')
|
|
||||||
openbadge_name=$(echo $openbadge_json | jq -r '.extensions.recipientProfile.name')
|
|
||||||
|
|
||||||
# generate da checksum from the provided credential and extracted salt
|
|
||||||
# sha256(<string provided credential><string extracted salt>)
|
|
||||||
generated_sha256=$(printf "$provided_credential$openbadge_salt" | sha256sum | awk '{print $1}')
|
|
||||||
|
|
||||||
# outputter
|
|
||||||
echo -e "\nTESTING '$provided_credential' AGAINST OPENBADGE FILE '$openbadge_file'\n\nProvided Credential: $provided_credential\nBadge File: $openbadge_file\n\tBadge URL: $openbadge_url\n\tSalt: $openbadge_salt\n\tNarrative: $openbadge_narrative\n\tSHA256 Checksum: $openbadge_sha256\nGenerated SHA256 Checksum: $generated_sha256\n\tFrom: sha256(<string credential><string salt>)"
|
|
||||||
|
|
||||||
# do dey maaaatch again>???
|
|
||||||
# but this time set retcode show succ or failure
|
|
||||||
if [ "$openbadge_sha256" = "$generated_sha256" ]; then
|
|
||||||
echo -e "\nSUCCESS: VERIFIED MATCH!"
|
|
||||||
exit 0
|
|
||||||
else
|
|
||||||
echo -e "\nFAIL: NO MATCH!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
@@ -1,69 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
# file paths
|
|
||||||
sha256_file_path=./checksums.sha256
|
|
||||||
md5_file_path=./checksums.md5
|
|
||||||
error_log=./checksums_error.log
|
|
||||||
|
|
||||||
# text colors
|
|
||||||
RED='\e[31m'
|
|
||||||
GREEN='\e[32m'
|
|
||||||
RESET='\e[0m'
|
|
||||||
|
|
||||||
# set these false at the start to be safe
|
|
||||||
checksha256=false
|
|
||||||
checkmd5=false
|
|
||||||
|
|
||||||
# output errors to error log
|
|
||||||
exec 2> >(tee -a "$error_log" >&2)
|
|
||||||
|
|
||||||
# environment checks
|
|
||||||
## check for presence of $sha256_file_path, fail with general error on error
|
|
||||||
if [ ! -f "$sha256_file_path" ]; then
|
|
||||||
echo -e "\n${RED}FAIL!${RESET} File $sha256_file_path Not Found!\n" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
## check if $sha256_file_path is writable
|
|
||||||
if [ ! -r "$sha256_file_path" ]; then
|
|
||||||
echo -e "\n${RED}FAIL!${RESET} File $sha256_file_path Exists But Not Readable!\n" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
## check for presence of $md5_file_path, fail with general error on error
|
|
||||||
if [ ! -f "$md5_file_path" ]; then
|
|
||||||
echo -e "\nFAIL! File $md5_file_path Not Found!\n" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
## check if $md5_file_path is writable
|
|
||||||
if [ ! -r "$md5_file_path" ]; then
|
|
||||||
echo -e "\n${RED}FAIL!${RESET} File $md5_file_path Exists But Not Readable!\n" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
# check checksums
|
|
||||||
## check sha256
|
|
||||||
if sha256sum -c "$sha256_file_path" 1>/dev/null; then
|
|
||||||
echo -e "SHA256 Checksums: ${GREEN}OK!${RESET}"
|
|
||||||
checksha256=true
|
|
||||||
else
|
|
||||||
echo -e "\n\nSHA256 Checksums: ${RED}BAD!${RESET}\nDumping SHA256 Checksum Fails:" >&2
|
|
||||||
sha256sum -c "$sha256_file_path" | grep 'FAILED' >&2
|
|
||||||
echo -e "\nSHA256 Checksums: ${RED}BAD!${RESET}\n" >&2
|
|
||||||
fi
|
|
||||||
## check md5
|
|
||||||
if md5sum -c "$md5_file_path" 1>/dev/null; then
|
|
||||||
echo -e "MD5 checksums: ${GREEN}OK!${RESET}"
|
|
||||||
checkmd5=true
|
|
||||||
else
|
|
||||||
echo -e "\n\nFAIL: MD5 Checksums: ${RED}BAD!${RESET}\n\tDumping MD5 Checksum Fails:" >&2
|
|
||||||
md5sum -c "md5_file_path" | grep 'FAILED' >&2
|
|
||||||
echo -e "\nMD5 Checksums: ${RED}BAD!${RESET}\n" >&2
|
|
||||||
fi
|
|
||||||
|
|
||||||
# tally checks
|
|
||||||
if [[ $checksha256 == true && $checkmd5 == true ]]; then
|
|
||||||
echo -e "\nFile Integrity: VERIFIED! All Checksums: ${GREEN}OK!${RESET}\n"
|
|
||||||
exit 0 # exit success
|
|
||||||
else
|
|
||||||
echo -e "\nFile Integrity Check: ${RED}FAILED!${RESET}\n\tSee Above or See $error_log" >&2
|
|
||||||
exit 1 # exit general failure
|
|
||||||
fi
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# file paths
|
|
||||||
sha256_file_path=./checksums.sha256
|
|
||||||
md5_file_path=./checksums.md5
|
|
||||||
error_log=./checksums_error.log
|
|
||||||
|
|
||||||
# text colors
|
|
||||||
RED='\e[31m'
|
|
||||||
YELLOW='\033[33m'
|
|
||||||
GREEN='\e[32m'
|
|
||||||
RESET='\e[0m'
|
|
||||||
|
|
||||||
# output errors to error log
|
|
||||||
exec 2> >(tee -a "$error_log" >&2)
|
|
||||||
|
|
||||||
if [ -f "sha256_file_path" ]; then
|
|
||||||
echo -e "${YELLOW}Warn${RESET}: Existing $sha256_file_path Found, Deleting..."
|
|
||||||
rm -f "sha256_file_path"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "$md5_file_path" ]; then
|
|
||||||
echo -e "${YELLOW}Warn${RESET}: Existing $md5_file_path Found, Deleting..."
|
|
||||||
rm -f "$md5_file_path"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -f "$error_log" ]; then
|
|
||||||
echo -e "${YELLOW}Warn${RESET}: Existing $error_log Found, Deleting..."
|
|
||||||
rm -f "$error_log"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# notify user
|
|
||||||
echo "Calculating SHA256 and MD5 Checksums Recursively into $sha256_file_path and $md5_file_path\n\t${YELLOW}This May Take a Long Time!${RESET}"
|
|
||||||
# exclude git
|
|
||||||
if find . -type f ! -path "*/.git/*" ! -path "$error_log" ! -path "$md5_file_path" ! -path "$sha256_file_path" ! -path "$0" ! -path "./check_checksums.sh" -exec bash -c "file_path={} && sha256sum \$file_path 1>> $sha256_file_path && md5sum \$file_path 1>> $md5_file_path" \;; then
|
|
||||||
echo -e "\n${GREEN}SUCCESS!${RESET} Generated SHA256 and MD5 Checksums into $sha256_file_path and $md5_file_path Respectively!\n"
|
|
||||||
exit 0 # explicitly exit success
|
|
||||||
else
|
|
||||||
echo -e "\n${RED}FAIL!${RESET} Failed to Generate SHA256 and MD5 Checksums! Check Error Output or Check Error Log: $error_log\n" >&2
|
|
||||||
exit 1 # explicitly fail
|
|
||||||
fi
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# set -euo pipefail # we tolerate no failure :pensive: 😔
|
|
||||||
|
|
||||||
# nullglobyyyy so da FUCKIN wildcard STOPS BEING A FUCK
|
|
||||||
shopt -s nullglob
|
|
||||||
|
|
||||||
# add da current dir name, and timedate stamp to it plus sum middleshit idk
|
|
||||||
default_file_name="$(date +%Y-%m-%d-%H%M-%Z)_$(printf '%s\n' ${PWD##*/})_ChecksumsSHA256.sha256"
|
|
||||||
|
|
||||||
existing_sha256_files=(*.sha256)
|
|
||||||
|
|
||||||
# just for spooky :3
|
|
||||||
## sumtin spookie :3
|
|
||||||
|
|
||||||
# if sha256 files exist, handle
|
|
||||||
if [ ${#existing_sha256_files[@]} -gt 0 ]; then
|
|
||||||
# existing sha256 files fond
|
|
||||||
echo "Existing *.sha256 files found in $PWD, Checking the Latest $default_file_name"
|
|
||||||
|
|
||||||
for file in *.sha256; do
|
|
||||||
# on fnding sha256 files in pwd, generate shas56 checks of each one, notify OK! on success, delete the offending sha256 file if fail
|
|
||||||
[ -f "$file" ] && sha256sum -c $file && echo -e "$file Check: \033[0;32mOK!\033[0m\n" || (echo -e "\n$file NO MATCH! Deleting Bad File \033[31mFAIL\033[0m\n\n"; rm -f $file) # 2>/dev/null)
|
|
||||||
done
|
|
||||||
# validate the found checksums
|
|
||||||
sha256sum -c *.sha256 | tee -a "$default_file_name" && echo -e "\nAll Checksums: \033[0;32mOK!\033[0m\n" || echo -e "\nOne or More Checksums Failed to Match: \033[33mWARN ($?)\033[0m\n"
|
|
||||||
else
|
|
||||||
# no sha256 files, run generate
|
|
||||||
echo "NO Existing *.sha256 files found! Generating sha256 checksums recursively"
|
|
||||||
|
|
||||||
# recursive search in current working dir,
|
|
||||||
find "$PWD" -type f -exec bash -c "sha256sum {} | tee -a \"$PWD/$default_file_name\"" \; && echo -e "\nAll Checksums Created: \033[0;32mOK!\033[0m\n\tLog File: $default_file_name\n" || echo -e "\nOne or More Cecksums Failed to Run: \033[31mWARN ($?)\033[0m\n"
|
|
||||||
fi
|
|
||||||
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
sleep 10
|
|
||||||
curl -L https://github.com/espressif/esp-idf/releases/download/v5.5.1/esp-idf-v5.5.1.zip
|
|
||||||
oniux curl -s https://canhazip.com
|
|
||||||
oniux curl -s https://canhazip.com
|
|
||||||
rm -f /tmp/*.tmp
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# todo
|
|
||||||
## pull commands from file with title
|
|
||||||
|
|
||||||
commands_to_test=("sudo mount -a" "lsblk" "sha256sum *img")
|
|
||||||
|
|
||||||
for command in "${commands_to_test[@]}"; do
|
|
||||||
memory_avg_bytes_before=$(free --bytes | rg 'Mem:' | awk '{print "Memory Usage (bytes) Before Test\nTotal\tUsed\tFree\tAvailable\n", $2, $3, $4, $6}')
|
|
||||||
load_avg_before=$(cat /proc/loadavg)
|
|
||||||
start=$(date +%s)
|
|
||||||
eval "$command"
|
|
||||||
retcode=$?
|
|
||||||
end=$(date +%s)
|
|
||||||
time=$(($end - $start)) # duration
|
|
||||||
load_avg_after=$(cat /proc/loadavg) # read da load avg, number of processes, and most recent process
|
|
||||||
memory_avg_bytes_after=$(free --bytes | rg 'Mem:' | awk '{print "Memory Usage (bytes) After Test\nTotal\tUsed\tFree\tAvailable\n", $2, $3, $4, $6}')
|
|
||||||
|
|
||||||
echo -e "${GREEN}Completed $command\n\tTime: $time seconds\n\tStart: $start\n\tEnd: $end\n\tLoad Average Initial: $load_avg_before\n\tLoad Average After $load_avg_after\n\tRetcode $retcode${RESET}"
|
|
||||||
echo -e "${GREEN}memory before${RESET}"
|
|
||||||
echo -e "$memory_avg_bytes_before"
|
|
||||||
echo -e "${GREEN}memory after${RESET}"
|
|
||||||
echo -e "$memory_avg_bytes_after"
|
|
||||||
done
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
finalDir='/usr/share/customscripts'
|
|
||||||
|
|
||||||
fix_perms() {
|
|
||||||
# fix ownership
|
|
||||||
echo -e "\nChanging ownership of $finalDir to $username:$username recursively"
|
|
||||||
sudo chown -R $username:$username $finalDir
|
|
||||||
|
|
||||||
# fix perms
|
|
||||||
echo -e "\nSetting perms of $finalDir and contents to 775"
|
|
||||||
sudo chmod -R 775 $finalDir
|
|
||||||
}
|
|
||||||
|
|
||||||
# ta get da right usermayhaps
|
|
||||||
if [[ -z $SUDO_USER ]]; then
|
|
||||||
echo "Using User $USER"
|
|
||||||
username="$USER"
|
|
||||||
else
|
|
||||||
echo "Using User $SUDO_USER"
|
|
||||||
username="$SUDO_USER"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -e "\nConfigure Discord Webhook Settings"
|
|
||||||
|
|
||||||
if [ -f /tmp/tag.txt ] && [ -f /tmp/webhook.txt ]; then
|
|
||||||
echo -e "\nExisting Webhook and Tag found. Using those values unless you enter new ones.\n"
|
|
||||||
|
|
||||||
existing_webhook=$(cat /tmp/webhook.txt)
|
|
||||||
existing_tag=$(cat /tmp/tag.txt)
|
|
||||||
|
|
||||||
echo -e "Existing Webhook URL: $existing_webhook"
|
|
||||||
echo -e "Existing Tag: $existing_tag\n"
|
|
||||||
|
|
||||||
# move em into place
|
|
||||||
sudo mv /tmp/tag.txt $finalDir/tag.txt
|
|
||||||
sudo mv /tmp/webhook.txt $finalDir/webhook.txt
|
|
||||||
|
|
||||||
# update permissions
|
|
||||||
fix_perms
|
|
||||||
|
|
||||||
exit 0 # exit ok
|
|
||||||
fi
|
|
||||||
|
|
||||||
# get webhook url
|
|
||||||
echo -e "\nEnter Discord Webhook URL"
|
|
||||||
read webhook_url
|
|
||||||
|
|
||||||
# get tag
|
|
||||||
echo -e "\nEnter Tag to Notify"
|
|
||||||
read webhook_tag
|
|
||||||
|
|
||||||
# write da files
|
|
||||||
sudo bash -c "echo '$webhook_url' > $finalDir/webhook.txt"
|
|
||||||
sudo bash -c "echo '$webhook_tag' > $finalDir/tag.txt"
|
|
||||||
|
|
||||||
fix_perms
|
|
||||||
|
|
||||||
echo -e "\n\nDone! Restarting shell..."
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
if [ -z "$1" ]; then
|
|
||||||
echo "Showing Wifi Interfaces:"
|
|
||||||
iwconfig
|
|
||||||
echo "Please Enter Wifi Interface:"
|
|
||||||
read interface
|
|
||||||
else
|
|
||||||
interface="$1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "Scanning Wifi Networks"
|
|
||||||
nmcli dev wifi list
|
|
||||||
|
|
||||||
if [ -z "$2" ]; then
|
|
||||||
echo "Please Enter SSID"
|
|
||||||
read ssid
|
|
||||||
else
|
|
||||||
ssid="$2"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z "$3" ]; then
|
|
||||||
echo "Please Enter Password"
|
|
||||||
read password
|
|
||||||
else
|
|
||||||
password="$2"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -e "\n\nConnect to $ssid with password $password on interface $interface \n\n"
|
|
||||||
pause
|
|
||||||
|
|
||||||
echo "Running ./fix-wifi.sh"
|
|
||||||
sudo bash ./fix-wifi.sh $interface
|
|
||||||
|
|
||||||
echo "Rescanning"
|
|
||||||
nmcli dev wifi rescan
|
|
||||||
|
|
||||||
echo "Connecting to $ssid"
|
|
||||||
nmcli device wifi connect $ssid password $password ifname $interface # --rescan yes
|
|
||||||
|
|
||||||
echo -e "\nnyaa mrrp done~ :D\n"
|
|
||||||
@@ -1,55 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# set -e
|
|
||||||
|
|
||||||
# date strings
|
|
||||||
start=`date +%s`
|
|
||||||
isodate=`date -I`
|
|
||||||
|
|
||||||
echo -e "\nStarting at `date`!\n"
|
|
||||||
|
|
||||||
lsblk
|
|
||||||
echo -e "\ninput disk full path (like /dev/sdX)"
|
|
||||||
read disk
|
|
||||||
|
|
||||||
echo -e "\ninput tag for image (no spaces or special chars)"
|
|
||||||
read file_tag
|
|
||||||
|
|
||||||
file_string=$isodate-$file_tag
|
|
||||||
out_dir=$PWD
|
|
||||||
out_img=$out_dir/$file_string.img
|
|
||||||
out_xz=$out_dir/$file_string.img.xz
|
|
||||||
info_log=$out_dir/$file_string.txt
|
|
||||||
|
|
||||||
echo -e "\nCOPYAN $disk to $out_img\n"
|
|
||||||
sudo dd if=$disk of=$out_img bs=4M status=progress
|
|
||||||
ret=$?
|
|
||||||
|
|
||||||
ddd=$(($end - `date +%s`))
|
|
||||||
echo -e "\nDONE COPYING IN $ddd SECONDS ($ret)!\n\nGetting size of $out_img!\n"
|
|
||||||
sudo du -h $out_img | tee -a $info_log
|
|
||||||
sudo du -b $out_img | tee -a $info_log
|
|
||||||
ret=$?
|
|
||||||
|
|
||||||
# ddd=$(($end - `date +%s`))
|
|
||||||
# echo -e "\nDONE GETTING SIZE IN $ddd SECONDS ($ret)!\n\n! MAKIN SHA256 CHECKSUM OF $out_img"
|
|
||||||
# sudo sha256sum $out_img | tee -a $info_log
|
|
||||||
# ret=$?
|
|
||||||
|
|
||||||
ddd=$(($end - `date +%s`))
|
|
||||||
echo -e "\nDONE GETTING SIZE IN $ddd SECONDS LOGGED TO $info_log ($ret)!\n\nRUNNOIG PISHRINK from $out_img to $out_xz\n"
|
|
||||||
sudo pishrink -Z -a -v $out_img
|
|
||||||
ret=$?
|
|
||||||
|
|
||||||
ddd=$(($end - `date +%s`))
|
|
||||||
echo -e "\nDONE RUNNING PISHRINK IN $ddd SECONDS ($ret)!\n\nGETTIN SIZE OF $out_xz\n"
|
|
||||||
sudo du -h $out_xz | tee -a $info_log
|
|
||||||
sudo du -b $out_xz | tee -a $info_log
|
|
||||||
ret=$?
|
|
||||||
|
|
||||||
ddd=$(($end - `date +%s`))
|
|
||||||
echo -e "\nDONE GETTING FILE SIZE IN $ddd SECONDS ($ret)!\n\aMAKIN SHA256 CHECKSUM OF $out_xz\n"
|
|
||||||
sha256sum $out_xz | tee -a $info_log
|
|
||||||
|
|
||||||
ddd=$(($end - `date +%s`))
|
|
||||||
echo -e "ALL DONE IN $ddd SECONDS!"
|
|
||||||
echo "Duration $duration seconds" >> $info_log
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
#Crowdsec Install and config
|
|
||||||
curl -s https://packagecloud.io/install/repositories/crowdsec/crowdsec/script.deb.sh | sudo bash
|
|
||||||
apt -y install crowdsec
|
|
||||||
truncate -s 0 /var/log/crowdsec.log
|
|
||||||
#configure bouncers as needed here https://hub.crowdsec.net/browse/#bouncers
|
|
||||||
apt -y install crowdsec-firewall-bouncer-iptables
|
|
||||||
cscli collections install crowdsecurity/base-http-scenarios
|
|
||||||
cscli bouncers add php-bouncer
|
|
||||||
systemctl reload crowdsec
|
|
||||||
#cscli bouncers add <nginx-bouncer php-bouncer wordpress-bouncer cloudflare-bouncer> #as needed
|
|
||||||
# SAVE API KEY, THEY ARE UNRECOVERABLE
|
|
||||||
#for wordpress: install crowdsec plugin in admin panel
|
|
||||||
# SAVE API KEY FROM INSTALL
|
|
||||||
# add API key
|
|
||||||
# LAPIU URL: http://localhost:8080
|
|
||||||
#for cpanel
|
|
||||||
#cscli scenarios install crowdsecurity/cpanel-bf
|
|
||||||
|
|
||||||
#unban an IP
|
|
||||||
#cscli decisions list
|
|
||||||
#cscli decisions delete --id <id number from list>
|
|
||||||
@@ -1,266 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# todo:
|
|
||||||
## packages to add:
|
|
||||||
## x enable start services: xrdp apache2 avahi-service
|
|
||||||
## x run customscripts
|
|
||||||
## make less interactive
|
|
||||||
### visudo
|
|
||||||
### su user
|
|
||||||
## x reboot
|
|
||||||
|
|
||||||
# set safety optinonz
|
|
||||||
set -o errexit # fail on error
|
|
||||||
set -o errtrace # run trace on error
|
|
||||||
set -o pipefail # fail on pipe fail
|
|
||||||
set -o nounset # fail on unset var
|
|
||||||
|
|
||||||
# packages
|
|
||||||
new_packages=(gawk curl wget git gh build-essential scrypt openssl argon2 qbittorrent xfce4 gparted xrdp xz-utils 7zip zip unzip gzip apache2 php php-cli php-bz2 php-crypt-gpg php-curl php-db php-doc php-email-validator cowsay iotop iptraf-ng gh btop htop screen byobu wget thefuck lynx zip unzip 7zip net-tools clamav php restic cifs-utils detox fdupes ffmpeg ripgrep avahi-daemon libnss-mdns xxd libimage-exiftool-perl ffuf wireshark hashcat snap pipx restic firefox)
|
|
||||||
|
|
||||||
# user info
|
|
||||||
new_username="princesspi"
|
|
||||||
groups_username=("tty" "dialout" "plugdev" "sudo" "www-data")
|
|
||||||
home_username="/home/${new_username}"
|
|
||||||
|
|
||||||
# services shit
|
|
||||||
services_to_enable=("ssh" "apache2" "xrdp" "avahi-daemon")
|
|
||||||
services_to_disable=("nginx")
|
|
||||||
|
|
||||||
# save here to use in error_handle function
|
|
||||||
num_of_args="$#"
|
|
||||||
all_args="$@"
|
|
||||||
|
|
||||||
# Define the cleanup function
|
|
||||||
error_handle() {
|
|
||||||
# CRITICAL: Capture the exit status code before ANY other command runs
|
|
||||||
local exit_code=$?
|
|
||||||
local script_path="$(realpath $0)"
|
|
||||||
local hr='===================================================='
|
|
||||||
echo
|
|
||||||
echo $hr
|
|
||||||
echo -e "🚨 \033[0;31m FATAL ERROR DETECTED \033[0m"
|
|
||||||
echo $hr
|
|
||||||
echo "-> Script : $0"
|
|
||||||
echo "-> Num Script Args : $num_of_args"
|
|
||||||
echo "-> Script Args : $all_args"
|
|
||||||
echo "-> Shell : $SHELL"
|
|
||||||
echo "-> Script Path : $script_path"
|
|
||||||
echo "-> Script (full) : $SHELL $script_path $all_args"
|
|
||||||
echo "-> User : $USER"
|
|
||||||
echo "-> Working Directory : $PWD"
|
|
||||||
echo "-> Failed Command : $BASH_COMMAND"
|
|
||||||
echo "-> Line Number : $LINENO"
|
|
||||||
echo "-> Exit Status : $exit_code"
|
|
||||||
echo "-> Seconds Elapsed : $SECONDS"
|
|
||||||
echo "-> Date Failed : $(date)"
|
|
||||||
# Generate a professional, clean stack traceback
|
|
||||||
echo "-> Stack Trace"
|
|
||||||
printf "\t" # to intent da stack trace
|
|
||||||
local frame=0
|
|
||||||
# Loop backwards through the function execution stack array
|
|
||||||
while caller $frame; do
|
|
||||||
printf "\t" # to indenet da stack trace
|
|
||||||
frame=$((frame + 1))
|
|
||||||
done
|
|
||||||
|
|
||||||
# closing niceties
|
|
||||||
echo
|
|
||||||
echo $hr
|
|
||||||
echo
|
|
||||||
|
|
||||||
# exit with last failcode
|
|
||||||
exit "$exit_code"
|
|
||||||
}
|
|
||||||
|
|
||||||
trap error_handle ERR
|
|
||||||
|
|
||||||
# to give pass/fail output from da commmands
|
|
||||||
## usage like checkcode $?
|
|
||||||
checkcode () {
|
|
||||||
if [ -z "$1" ]; then
|
|
||||||
echo -e "\n\e[31mERROR!\033[0m chkcode missing return code paramater\n"
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
retcode=$1
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $retcode -ne 0 ]; then
|
|
||||||
echo -e "\t\e[31mERROR!\033[0m Response Code: $retcode"
|
|
||||||
else
|
|
||||||
echo -e '\t\e[1;32mOK!\e[0m'
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
reload_shell() {
|
|
||||||
echo "reload_shell: START"
|
|
||||||
echo "reload_shell: sourcing to $home_username/.bashrc"
|
|
||||||
source "$home_username/.bashrc"
|
|
||||||
checkcode $?
|
|
||||||
echo "reload_shell: reloading shell"
|
|
||||||
exec "$SHELL"
|
|
||||||
checkcode $?
|
|
||||||
echo "reload_shell: FINISHED"
|
|
||||||
}
|
|
||||||
|
|
||||||
reset_root() {
|
|
||||||
echo "reset_root: START"
|
|
||||||
echo "reset_root: change password"
|
|
||||||
sudo passwd root
|
|
||||||
checkcode $?
|
|
||||||
echo "reset_root: FINISHED"
|
|
||||||
}
|
|
||||||
|
|
||||||
user() {
|
|
||||||
echo "user: START"
|
|
||||||
echo "user: create $new_username"
|
|
||||||
useradd "$new_username"
|
|
||||||
checkcode $?
|
|
||||||
echo "user: adding groups"
|
|
||||||
for group in "${groups_username[@]}"; do
|
|
||||||
echo "user: adding $new_username to group $group"
|
|
||||||
usermod -aG $group $new_username &> /dev/null
|
|
||||||
checkcode $?
|
|
||||||
done
|
|
||||||
echo "user: FINISHED"
|
|
||||||
}
|
|
||||||
|
|
||||||
apt() {
|
|
||||||
echo "apt: START"
|
|
||||||
echo "apt: updating"
|
|
||||||
sudo apt update &> /dev/null
|
|
||||||
checkcode $?
|
|
||||||
echo "apt: running dist-upgrade"
|
|
||||||
sudo apt dist-upgrade -y &> /dev/null
|
|
||||||
checkcode $?
|
|
||||||
echo "apt: install packages"
|
|
||||||
sudo apt install -y "${new_packages[@]}" &> /dev/null
|
|
||||||
checkcode $?
|
|
||||||
sudo snap install urh
|
|
||||||
checkcode $?
|
|
||||||
echo "apt: autoremoving"
|
|
||||||
sudo apt autoremove -y &> /dev/null
|
|
||||||
checkcode $?
|
|
||||||
echo "apt: FINISHED"
|
|
||||||
}
|
|
||||||
|
|
||||||
pyenv() {
|
|
||||||
echo "pyenv: START"
|
|
||||||
echo "pyenv: installin"
|
|
||||||
curl -fsSL https://pyenv.run | bash &> /dev/null
|
|
||||||
checkcode $?
|
|
||||||
echo "pyenv: adding exports to $home_username/.bashrc"
|
|
||||||
echo 'export PYENV_ROOT="$HOME/.pyenv"' >> "$home_username/.bashrc"
|
|
||||||
checkcode $?
|
|
||||||
echo '[[ -d $PYENV_ROOT/bin ]] && export PATH="$PYENV_ROOT/bin:$PATH"' >> "$home_username/.bashrc"
|
|
||||||
checkcode $?
|
|
||||||
echo 'eval "$(pyenv init -)"' >> "$home_username/.bashrc"
|
|
||||||
checkcode $?
|
|
||||||
echo "pyenv: sourcing to $home_username/.bashrc"
|
|
||||||
source "$home_username/.bashrc"
|
|
||||||
checkcode $?
|
|
||||||
echo "pyenv: installing latest python3"
|
|
||||||
latest_python=$(pyenv install --list | grep -E '^[[:space:]]*3\.[0-9]+\.[0-9]+$' | tail -1 | tr -d '[:space:]')
|
|
||||||
if [ -z "$latest_python" ]; then
|
|
||||||
echo "pyenv: could not detect latest Python 3 version"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
pyenv install "$latest_python" &> /dev/null
|
|
||||||
checkcode $?
|
|
||||||
echo "pyenv: setting latest python3 as global"
|
|
||||||
pyenv global "$latest_python" &> /dev/null
|
|
||||||
checkcode $?
|
|
||||||
reload_shell
|
|
||||||
echo "pyenv: FINISHED"
|
|
||||||
}
|
|
||||||
|
|
||||||
blesh() {
|
|
||||||
echo "ble.sh: START"
|
|
||||||
echo "ble.sh: changing directory to /tmp"
|
|
||||||
cd /tmp
|
|
||||||
checkcode $?
|
|
||||||
echo "ble.sh: downloading"
|
|
||||||
git clone --recursive --depth 1 --shallow-submodules --single-branch -b master https://github.com/akinomyoga/ble.sh.git &> /dev/null
|
|
||||||
checkcode $?
|
|
||||||
echo "ble.sh: building and installing"
|
|
||||||
make -C ble.sh install PREFIX=$home_username/.local &> /dev/null
|
|
||||||
checkcode $?
|
|
||||||
echo "ble.sh: setting up $home_username/.bashrc file"
|
|
||||||
echo '# ble.sh' >> $home_username/.bashrc
|
|
||||||
checkcode $?
|
|
||||||
echo 'source -- $home_username/.local/share/blesh/ble.sh' >> $home_username/.bashrc
|
|
||||||
checkcode $?
|
|
||||||
reload_shell
|
|
||||||
echo "ble.sh: FINISHED"
|
|
||||||
}
|
|
||||||
|
|
||||||
wordists() {
|
|
||||||
echo "wordlists: START"
|
|
||||||
echo "wordlists: making $home_username/wordlists dir"
|
|
||||||
mkdir -p $home_username/wordlists &> /dev/null
|
|
||||||
checkcode $?
|
|
||||||
echo "wordlists: downloading seclists to $home_username/wordlists"
|
|
||||||
git clone --single-branch https://github.com/danielmiessler/SecLists.git $home_username/wordlists/SecLists &> /dev/null
|
|
||||||
# todo: finish
|
|
||||||
echo "wordlists: FINISHED"
|
|
||||||
}
|
|
||||||
|
|
||||||
services() {
|
|
||||||
echo "services: START"
|
|
||||||
echo "services: disable"
|
|
||||||
for service in "${services_to_disable[@]}"; do
|
|
||||||
echo "services: disabling $service"
|
|
||||||
sudo systemctl disable "$service"
|
|
||||||
checkcode $?
|
|
||||||
echo "services: stopping $service"
|
|
||||||
sudo systemctl stop "$service"
|
|
||||||
checkcode $?
|
|
||||||
done
|
|
||||||
echo "services: enable"
|
|
||||||
for service in "${services_to_enable[@]}"; do
|
|
||||||
echo "services: enabling $service"
|
|
||||||
sudo systemctl enable "$service" &> /dev/null
|
|
||||||
checkcode $?
|
|
||||||
echo "services: starting $service"
|
|
||||||
sudo systemctl start "$service" &> /dev/null
|
|
||||||
checkcode $?
|
|
||||||
done
|
|
||||||
echo "services: FINISHED"
|
|
||||||
}
|
|
||||||
|
|
||||||
customscripts() {
|
|
||||||
echo "customscripts: START"
|
|
||||||
script="/tmp/install_script.sh"
|
|
||||||
echo "customscripts: downloading general-scripts-and-system-ssssssetup installer"
|
|
||||||
curl -s https://raw.githubusercontent.com/PrincessPi3/general-scripts-and-system-ssssssetup/refs/heads/main/customscripts/install_script.sh > "$script"
|
|
||||||
checkcode $?
|
|
||||||
echo "customscripts: making $script executable"
|
|
||||||
chmod +x "$script"
|
|
||||||
checkcode $?
|
|
||||||
echo "customscripts: running $script"
|
|
||||||
bash -c "$script full"
|
|
||||||
checkcode $?
|
|
||||||
echo "customscripts: running configure_webhook.sh full"
|
|
||||||
bash /usr/share/customscripts/configure_webhook.sh full
|
|
||||||
checkcode $?
|
|
||||||
echo "customscripts: updating user .bashrc"
|
|
||||||
echo 'export PATH="$PATH:/usr/share/customscripts"' >> "$home_username/.bashrc"
|
|
||||||
checkcode $?
|
|
||||||
reload_shell
|
|
||||||
}
|
|
||||||
|
|
||||||
reboot() {
|
|
||||||
echo "reboot: START"
|
|
||||||
echo "reboot: setting to reboot in one minute"
|
|
||||||
sudo shutdown -r +1
|
|
||||||
echo "reboot: FINISHED"
|
|
||||||
}
|
|
||||||
|
|
||||||
# run in order
|
|
||||||
user
|
|
||||||
apt
|
|
||||||
pyenv
|
|
||||||
blesh
|
|
||||||
wordlists
|
|
||||||
services
|
|
||||||
customscripts
|
|
||||||
reboot
|
|
||||||
@@ -1,15 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Usage
|
|
||||||
# dirstat <path>
|
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
|
||||||
path=.
|
|
||||||
else
|
|
||||||
path=$1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -e "\nPath: $path"
|
|
||||||
echo "Space used: $(du -h -d 0 $path | awk '{print $1}')"
|
|
||||||
echo "Files: $(find $path -type f -print | wc -l)"
|
|
||||||
echo "Directories: $(find $path -type d -print | wc -l)"
|
|
||||||
uptime
|
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
gcc -o "donut" "donut.c" -lm
|
|
||||||
|
|
||||||
if [ $? -ne 0 ];
|
|
||||||
echo "fuck da compiling failed fuuuck"
|
|
||||||
else
|
|
||||||
echo "fixing perms"
|
|
||||||
sudo chmod 755 /usr/share/customscripts/donut
|
|
||||||
echo "Fixing ownership"
|
|
||||||
sudo chown princesspi:princesspi
|
|
||||||
echo "Cleaning up"
|
|
||||||
sudo rm -f /usr/share/customscripts/donut
|
|
||||||
echo "done!"
|
|
||||||
fi
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
#include <stdio.h>
|
|
||||||
#include <string.h>
|
|
||||||
int k = 0;double sin()
|
|
||||||
,cos();int main(){float A=
|
|
||||||
0,B=0,i,j,z[1760];char b[
|
|
||||||
1760];printf("\x1b[2J");for(;;
|
|
||||||
){memset(b,32,1760);memset(z,0,7040)
|
|
||||||
;for(j=0;6.28>j;j+=0.07)for(i=0;6.28
|
|
||||||
>i;i+=0.02){float c=sin(i),d=cos(j),e=
|
|
||||||
sin(A),f=sin(j),g=cos(A),h=d+2,D=1/(c*
|
|
||||||
h*e+f*g+5),l=cos (i),m=cos(B),n=s\
|
|
||||||
in(B),t=c*h*g-f* e;int x=40+30*D*
|
|
||||||
(l*h*m-t*n),y= 12+15*D*(l*h*n
|
|
||||||
+t*m),o=x+80*y, N=8*((f*e-c*d*g
|
|
||||||
)*m-c*d*e-f*g-l *d*n);if(22>y&&
|
|
||||||
y>0&&x>0&&80>x&&D>z[o]){z[o]=D;;;b[o]=
|
|
||||||
".,-~:;=!*#$@"[N>0?N:0];}}/*#****!!-*/
|
|
||||||
printf("\x1b[H");for(k=0;1761>k;k++)
|
|
||||||
putchar(k%80?b[k]:10);A+=0.04;B+=
|
|
||||||
0.02;}}/*****####*******!!=;:~
|
|
||||||
~::==!!!**********!!!==::-
|
|
||||||
.,~~;;;========;;;:~-.
|
|
||||||
..,--------,*/
|
|
||||||
@@ -1,63 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
tmp_links_file="/tmp/links.tmp"
|
|
||||||
tmp_file_download="/tmp/download.tmp"
|
|
||||||
|
|
||||||
nano "$tmp_links_file"
|
|
||||||
read -p "Enter output directory: " outdir
|
|
||||||
|
|
||||||
# manually created arrays for file types and extensions
|
|
||||||
## notes: from twitter downloader mp4 files show as ISO?
|
|
||||||
types_arr=('MPEG' 'ISO' 'JPEG' 'PNG' 'GIF' 'WebM' 'RIFF')
|
|
||||||
exts_arr=('mp4' 'mp4' 'jpg' 'png' 'gif' 'webm' 'webp')
|
|
||||||
|
|
||||||
# create the out dir if not extant
|
|
||||||
if [ ! -d "$outdir" ]; then
|
|
||||||
echo "Output directory does not exist: $outdir Creating"
|
|
||||||
mkdir "$outdir"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# read the input file and loop through it
|
|
||||||
cat "$tmp_links_file" | \
|
|
||||||
while read line; do
|
|
||||||
# get default basename of downloaded file
|
|
||||||
file_basename=$(basename "$line")
|
|
||||||
|
|
||||||
echo "Downloading $line" # to $outdir/$file_basename"
|
|
||||||
|
|
||||||
# download the file to a tmp
|
|
||||||
curl -s -o "$tmp_file_download" "$line"
|
|
||||||
|
|
||||||
# get the file type
|
|
||||||
type=$(file "$tmp_file_download" | awk '{print $2}')
|
|
||||||
|
|
||||||
# md5 hash the file for a deterministic file name
|
|
||||||
namehash=$(md5sum "$tmp_file_download" | awk '{print $1}')
|
|
||||||
|
|
||||||
# map the file type to the corresponding extension
|
|
||||||
count=0
|
|
||||||
# loop through types for patch with file type
|
|
||||||
for item in "${types_arr[@]}"; do
|
|
||||||
if [[ " ${types_arr[@]} " =~ " ${type} " ]]; then
|
|
||||||
# if type matches
|
|
||||||
if [[ "$item" == "$type" ]]; then
|
|
||||||
# rename the downloaded file
|
|
||||||
new_name="$outdir/$namehash.$(echo ${exts_arr[$count]})"
|
|
||||||
echo -e "\tto $new_name"
|
|
||||||
mv "$tmp_file_download" "$new_name"
|
|
||||||
if [ $? -ne 0 ]; then
|
|
||||||
echo -e "\nFailed to rename $tmp_file_download to $new_name\n\turl\n\t$line\n\ttype $type\n\tbase name: $file_basename\n"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
else
|
|
||||||
echo -e "\n$file_basename not a supported format: $type $(file $tmp_file_download)!\n\turl: $line\n\ttype: $type\n\tbase name: $file_basename\n\tfile: $(file $tmp_file_download)\n"
|
|
||||||
rm -f "$tmp_file_download"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# increment the count regardless
|
|
||||||
count=$((count + 1))
|
|
||||||
done
|
|
||||||
done
|
|
||||||
|
|
||||||
# cleanup
|
|
||||||
rm -f "$tmp_links_file" >/dev/null 2>&1 # suppress errors or output
|
|
||||||
rm -f "$tmp_file_download" >/dev/null 2>&1 # suppress errors or output
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
links_file_tmp=$(mktemp)
|
|
||||||
nano "$links_file_tmp"
|
|
||||||
cat "$links_file_tmp" | \
|
|
||||||
while read line; do
|
|
||||||
wget -nc "$line" # nc = no clobber, fail if file exists no rename no overwrite
|
|
||||||
done
|
|
||||||
rm -f "$links_file_tmp"
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# todo:
|
|
||||||
# offline option
|
|
||||||
## dd raw .img
|
|
||||||
## enum partitions
|
|
||||||
### file zero fill empty space of good partitions
|
|
||||||
### dd zero fill unformatted space and such
|
|
||||||
### xz compress
|
|
||||||
# online option
|
|
||||||
## enum partitions
|
|
||||||
## attempt to mount all possible
|
|
||||||
## file zero fill them
|
|
||||||
## dd zero fill unformatted space
|
|
||||||
## take offline for xz inline rip
|
|
||||||
|
|
||||||
set -e # fail explicitly on any error
|
|
||||||
|
|
||||||
# todo: interactive, cli options
|
|
||||||
# disk=/dev/sda
|
|
||||||
user=princesspi
|
|
||||||
# outname="test_disk_image_post0_$(date +%Y-%m-%d-%H%M-%Z)"
|
|
||||||
outname="$outname.img.xz"
|
|
||||||
zerofile="/home/$user/0.0"
|
|
||||||
|
|
||||||
echo "zeroing out empty space"
|
|
||||||
sudo if=/dev/zero of="$zerofile" bs=4M status=progress || sudo rf -f "$zerofile"
|
|
||||||
|
|
||||||
# do the disk image dump using inline xz
|
|
||||||
# echo "runnin inline xz on $disk to file $outname"
|
|
||||||
# sudo dd if=$disk status=progress bs=4M | xz -c > "$outname"
|
|
||||||
|
|
||||||
# test xz integrity
|
|
||||||
# echo "testing disk image integrity"
|
|
||||||
# xz -t -v "$outname"
|
|
||||||
|
|
||||||
# make the sha256 file
|
|
||||||
# echo "generating sha256 checksum file"
|
|
||||||
# sha256sum "$outname" | tee "$outname.sha256"
|
|
||||||
|
|
||||||
echo "all donesies :3"
|
|
||||||
@@ -1,193 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# todo
|
|
||||||
## x make safe and gay mode optional
|
|
||||||
## dont re-fuck existing sha256 files ig
|
|
||||||
## or ig test and leave as is or append new val and date
|
|
||||||
## x joplin export as pdf
|
|
||||||
## x git (?)
|
|
||||||
## x args normalization
|
|
||||||
# x if args contain FAG (case insensitive) den gay and safe mode enabled
|
|
||||||
# x if args contain NUKE (case insensitive) den nuke all dem sha256 files
|
|
||||||
# x if args contain GIT (case insensitive) den ig do da fuckin asshole git b
|
|
||||||
# x if args contain VALIDATE (case insensitive) then verify sha256 cheksums from pre-calculated files
|
|
||||||
## nosleep start and stop
|
|
||||||
## x clean up/create error.log
|
|
||||||
## test for files missing paired sha256 files, log to error.log
|
|
||||||
## test for mismatches to sha256 files log to error.log
|
|
||||||
## x set error trap to ensure all stderr is tee -a'd to terminal and error.log
|
|
||||||
## fast scan for attributes vs slow scan with sha256
|
|
||||||
## both scans always running, alongside looping restic backups
|
|
||||||
## solve any race conditinos
|
|
||||||
## environment check
|
|
||||||
## sanity checks
|
|
||||||
## duplicate/conflict behavior
|
|
||||||
|
|
||||||
# date shit
|
|
||||||
start_date="$(date)" # date ig
|
|
||||||
|
|
||||||
# sum text colorz
|
|
||||||
RED='\033[0;31m' # anmgry red
|
|
||||||
YELLOW='\033[0;33m' # BOLD yellow :"3
|
|
||||||
GREEN='\033[1;32m' # bold green :3
|
|
||||||
RESET='\033[0m' # reset color
|
|
||||||
|
|
||||||
echo -e "${GREEN}Script Started at $start_date With $SECONDS Seconds Elapsed on Line number: $LINENO${RESET}"
|
|
||||||
|
|
||||||
# get all dem args into one single fuck (space seperated)
|
|
||||||
argz="$@"
|
|
||||||
|
|
||||||
# do you wanna be a safetyfag or be based?
|
|
||||||
shopt -s nocasematch # magic no case match bs
|
|
||||||
set -Eeuo pipefail # fail on any error including pipe fail and use error trap
|
|
||||||
# backup_dir="/mnt/d/Anbernic_Research_Tinkering_Save" # dir to protect
|
|
||||||
backup_dir="/mnt/c/Users/human/Downloads/tint"
|
|
||||||
error_log="${backup_dir}/error.log" # errror log path
|
|
||||||
path_error_log="$error_log" # duplicated cus lazy
|
|
||||||
exec 2> >(tee -a "$path_error_log" >&2) # output any stderror to both screen and error log
|
|
||||||
cd "$backup_dir" # enter dir to work in
|
|
||||||
|
|
||||||
if [ -f $path_error_log ]; then
|
|
||||||
echo -e "${GREEN}Found $path_error_log clearing at $(date) With $SECONDS Elapsed At Line Number $LINENO${RESET}"
|
|
||||||
echo > "$path_error_log" # initialize as empty
|
|
||||||
else
|
|
||||||
echo -e "${GREEN}No $path_error_log fiound, creating at $(date) With $SECONDS Elapsed At Line Number $LINENO${RESET}"
|
|
||||||
touch "$path_error_log" # create and initialize
|
|
||||||
fi
|
|
||||||
|
|
||||||
# on error, fail and dump as much information as possible to terminal, webhook, and error log
|
|
||||||
# trap error_handler ERR
|
|
||||||
error_handler () {
|
|
||||||
infostring="${RED}\n\n\nERROR IN SCRIPT:\n\n\t$SECONDS Seconds Elapsed\n\tDate $(date)\n\tOn Line: $LINENO\n\tUsing command $BASH_COMMAND\n\tReturn Code: $?\n\tError log: $path_error_log\n\tRecorded Args: ${@}${RESET}\n\n"
|
|
||||||
webhook "$infostring" true # dump data to terminal and webhook
|
|
||||||
echo -e >> "$path_error_log" # dump data to error log
|
|
||||||
}
|
|
||||||
|
|
||||||
echo -e "${GREEN}Made it past varr declaratgions and such at $(date) With $SECONDS Elapsed At Line Number $LINENO${RESET}"
|
|
||||||
|
|
||||||
environment_checks () {
|
|
||||||
# tests if backup dir is a directory and available
|
|
||||||
if [ ! -d "$backup_dir" ]; then
|
|
||||||
echo -e "\n\n\n${RED}Supplied backup dir: $backup_dir not present, not available, out of permissions, or is not a directory"
|
|
||||||
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo -e "${GREEN}OK! Backup Dir GOOD${RESET}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# tests current location
|
|
||||||
if [[ "$PWD" != "$backup_dir" ]]; then
|
|
||||||
echo -e "\n\n\n${RED}pwd: $PWD does not match specified dir: $backup Dir, FAIL. Exiting.${RESET}\n\n\n" # notify
|
|
||||||
|
|
||||||
exit 1 # exit with error
|
|
||||||
else
|
|
||||||
echo -e "${GREEN}OK! Backup Dir IS Current Location!${RESET}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# test for error log
|
|
||||||
if [ ! -f "$path_error_log" ]; then
|
|
||||||
echo -e "\n\n\n${RED}error log at path: $path_error_log not present, not available, out of permissions, or is not a directory${RESET}\n\n\n" # notify
|
|
||||||
|
|
||||||
exit 1
|
|
||||||
else
|
|
||||||
echo -e "${GREEN}OK! Error Log GOOD${RESET}"
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo -e "${GREEN}Environment Checks GOOD!${RESET}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# if [[ "$argz" =~ "FAG" ]]; then
|
|
||||||
# echo -e "\n\n\n${RED}OK FAGGOT YOU RAN ARG1 WITH FAG SO NOW YOU GET FUCKFAG SAFE MNODE LIKE THE QUEER U R${RESET}\nOH YE ALL YA GAY LIL ERRORS NOW LOGGIN TO $path_error_log\n\n\n"
|
|
||||||
# # make da error log for further humiliation\
|
|
||||||
# # if error log present, delete it and replace with blank file
|
|
||||||
# if [ -f "$path_error_log" ]; then
|
|
||||||
# rm -f "$path_error_log" # delete
|
|
||||||
# touch "$path_error_log" # make empty file
|
|
||||||
# fi
|
|
||||||
# # notify the user of what a genuine bitch they are
|
|
||||||
# fi
|
|
||||||
|
|
||||||
# makin a trappy to make sure as fuuuck dat no fucky wucky gets dafuq by meeee
|
|
||||||
# trap '\033[0;31m webhook "SHIT SHIT SHIT SHIT DA EXIT TRAP FUCKIN SPRUNG FFUUUCK\n\tLine number: $LINENO\n\tFailing on command $BASH_COMMAND\y\tResponse code: $?\n\tStderr shown on screen and logged to $path_error_log ${RESET}\nArgs returned: $@\n\t\n\n\033[0m' EXIT
|
|
||||||
|
|
||||||
function generate_sha256_checksums () {
|
|
||||||
webhook "${GREEN}startin calculatin all dem gay af sha256 files\n\t$SECONDS seconds elapsed\n\tDate: $(date)${RESET}"
|
|
||||||
|
|
||||||
# use black magic to generatre da sha256 files
|
|
||||||
find "$backup_dir" -type f -name "*.sha256" -prune -o -name ".git" -exec bash -c "for f in \"\$@\"; do; sha256sum \$f | tee -a \$f.sha256; done; _ {} +" \; # aeswrfgv
|
|
||||||
|
|
||||||
### bash -c "for f in \"\$@\"; do if [ -f \"\${f}.sha256\" ]; then continue; fi; sha256sum -c \"\${f}.sha256\" | tee -a \"${path_error_log}\"; done" _ {} + # sum horrifying shitfuck idk
|
|
||||||
|
|
||||||
webhook "${GREEN}finished calculatin all dem gay af sha256 files\n\t$SECONDS seconds elapsed${RESET}"
|
|
||||||
}
|
|
||||||
|
|
||||||
# ig git is unsuited for version controllin fuckhuge fiels ig
|
|
||||||
## so ig i comment it out
|
|
||||||
## sum git shit to maintain archive or sum shit
|
|
||||||
## if arg1 containz GIT then do da gitshit
|
|
||||||
do_git () {
|
|
||||||
# notify the user of this bullshit
|
|
||||||
echo -e "${GREEN}FAggot im doin da fuckin git bullshit even tho is fuckslow${RESET}"
|
|
||||||
webhook "doin sum git"
|
|
||||||
# do da git conditionally if need be init
|
|
||||||
if [ ! -d "${backup_dir}/.git" ]; then # if .git dir not be there, initialize it fag
|
|
||||||
git -C "$backup_dir" init 2>>"$path_error_log" # init git if da shit aint there
|
|
||||||
# git -C "$backup_dir" branch -m master # set branch to main (?)
|
|
||||||
git -C "$backup_dir" add "$backup_dir" 2>>"$path_error_log"
|
|
||||||
git -C "$backup_dir" commit -m "initial auto archive date: $(date +%s)" 2>>"$path_error_log"
|
|
||||||
else
|
|
||||||
git -C "$backup_dir" add "$backup_dir" 2>>"$path_error_log"
|
|
||||||
git -C "$backup_dir" commit -m "auto archive $(date +%s)" 2>>"$path_error_log" # commit wit date
|
|
||||||
# notify finished with fuckgit
|
|
||||||
fi
|
|
||||||
|
|
||||||
webhook "done doin sum git"
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
# do da fookin sha256sums first ig
|
|
||||||
# # if arg1 contains NUKE (case insensititve den nuke dem fuckin sha256 fiels)
|
|
||||||
# if [[ "$argz" =~ "NUKE" ]]; then
|
|
||||||
# webhook "startin sha256 clearin\n\t$SECONDS seconds elapsed"
|
|
||||||
# # notify user that they are a fag
|
|
||||||
# echo -e "${RED}FAGGOT MODE ENABLED SO IM NUKIN ALL DEM SHA256 FIELS FUCK U${RESET}"
|
|
||||||
# # nuke da sha256 files finafuckingky
|
|
||||||
# find "$backup_dir" -prune -o -name ".git" -type f -name "*.sha256" -delete # nuke dem fookan fuckfiels
|
|
||||||
# # finished nukan math
|
|
||||||
# webhook "${GREEN}finished clearin sha256 fiels\n\t$SECONDS seconds elapsed${RESET}"
|
|
||||||
#
|
|
||||||
# webhook "Now creating new sha256 sums files"
|
|
||||||
# generate_sha256_checksums
|
|
||||||
# fi
|
|
||||||
|
|
||||||
# check already generated sha256 checksums
|
|
||||||
# if [[ "$argz" =~ "VALIDATE" ]]; then
|
|
||||||
check_generate_checksums () {
|
|
||||||
webhook "Generating new sha256sums files for those that lack one"
|
|
||||||
generate_sha256_checksums
|
|
||||||
|
|
||||||
webhook "\n\nchecking pre-calculated sha256 sums"
|
|
||||||
# find every sha256 file do the checksum
|
|
||||||
find "$backup_dir" -prune -o -name ".git" -type f -iname "*.sha256" -exec bash -c "echo -e \"${GREEN}\nstarting check sha256sums of files\n\tcurrent file: {}\n\t total elpapsed: $SECONDS seconds\n\"; sha256sum -c {} | tee -a \"${path_error_log}\"; echo -e \"ARGS: $@\n\n${RESET}\"" \;
|
|
||||||
}
|
|
||||||
|
|
||||||
restic_backups () {
|
|
||||||
webhook "runnin Anbernic backup restic powershell\n\t$SECONDS seconds elapsed"
|
|
||||||
# may god have mercy on my soul for mixing powershell and bash
|
|
||||||
pwsh.exe -File "D:\Anbernic-Hackin-Archive_restic_backup.ps1" # do da restic backup ps1
|
|
||||||
# finished restic backloops
|
|
||||||
webhook "finished runnin restic Anbernic shit\n\t$SECONDS seconds elapsed"
|
|
||||||
}
|
|
||||||
|
|
||||||
box_force_shutdown () {
|
|
||||||
# shutdown by force of powershell huehhuehue
|
|
||||||
webhook "TIME TO SHUT THE FUCK DOWN WOOOO\n\t$SECONDS Seconds Elapsed\n\tStart Date: $start_date\n\tEnd Date: $(date)" true # true so it pingas mneeee
|
|
||||||
|
|
||||||
# hateful cursed powershell call to shut off box ffs
|
|
||||||
# pwsh.exe -C "Stop-Computer -Force" # i reeally dgaf this is so terribly fuckin cursed
|
|
||||||
}
|
|
||||||
|
|
||||||
environment_checks
|
|
||||||
# do_git
|
|
||||||
check_generate_checksums
|
|
||||||
restic_backups
|
|
||||||
# box_force_shutdown
|
|
||||||
@@ -1,14 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# tmp links file
|
|
||||||
tmpfile="/tmp/links.tmp"
|
|
||||||
|
|
||||||
# get links
|
|
||||||
nano "$tmpfile"
|
|
||||||
|
|
||||||
# download to .
|
|
||||||
cat "$tmpfile" | while read line; do
|
|
||||||
wget "$line"
|
|
||||||
done
|
|
||||||
|
|
||||||
# cleanup
|
|
||||||
rm -f "$tmpfile" 1>/dev/null 2>&1 # suppress errors or output
|
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
tmp_file="./exts.tmp"
|
|
||||||
exts_study_file="./extension_study.txt"
|
|
||||||
|
|
||||||
echo "" > "$tmp_file"
|
|
||||||
find ./files -type f -exec bash -c "echo \"{}\" | awk -F. '{print \$NF}' | tee -a \"$tmp_file\"" \;
|
|
||||||
cat "$tmp_file" | sort | uniq > "$exts_study_file"
|
|
||||||
rm -f "$tmp_file"
|
|
||||||
|
|
||||||
echo "DONE! Saved to $exts_study_file"
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
if [ -z "$1" -o -z "$2" ]; then
|
|
||||||
echo -e "usage:\n\tfind_bytes <unicode regex> <path> \n\t\tex. find_bytes '[\x{20}]' /path/to/dir\n\tdocs: https://ugrep.com"
|
|
||||||
exit
|
|
||||||
else
|
|
||||||
# ugrep
|
|
||||||
# ugrep docs https://ugrep.com
|
|
||||||
# -W hexdump binary matches, while keeping text matches as text
|
|
||||||
# -z decompress files if need be to scan them
|
|
||||||
# -R recursive
|
|
||||||
# ug -W -z -R <unicode regex> <path>
|
|
||||||
# bytes in sequence '\x{0d}\x{0a}'
|
|
||||||
# mix of bytes sans sequence '[\x{0d}\x{0a}]'
|
|
||||||
# normal regex applies '[\x{0d}\x{0a}]{4,6}'
|
|
||||||
ug -W -z -R $1 $2
|
|
||||||
fi
|
|
||||||
@@ -1,49 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
if [ -z "$1" ]; then
|
|
||||||
echo "Showing Wifi Interfaces:"
|
|
||||||
iwconfig
|
|
||||||
echo "Please Enter Wifi Interface:"
|
|
||||||
read wifi_device
|
|
||||||
echo "Selected ${wifi_device}"
|
|
||||||
else
|
|
||||||
wifi_device="$1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
# wifi_device=$1
|
|
||||||
|
|
||||||
echo 'Starting NetworkManager.service'
|
|
||||||
sudo systemctl restart NetworkManager
|
|
||||||
|
|
||||||
echo 'Restarting wpa_supplicant'
|
|
||||||
sudo systemctl restart wpa_supplicant
|
|
||||||
|
|
||||||
echo 'Disconnecting from wifi'
|
|
||||||
sudo nmcli d disconnect $wifi_device
|
|
||||||
|
|
||||||
echo 'Deleting all wifi saved networks'
|
|
||||||
nmcli connection show | sudo awk '{system("nmcli connection delete " $1)}'
|
|
||||||
|
|
||||||
echo 'Bringing down interface'
|
|
||||||
sudo ifconfig $wifi_device down
|
|
||||||
|
|
||||||
echo 'Bringing back up interface'
|
|
||||||
sudo ifconfig $wifi_device up
|
|
||||||
|
|
||||||
echo 'Reloading network manager'
|
|
||||||
sudo nmcli g reload
|
|
||||||
|
|
||||||
echo 'Turning off network manager'
|
|
||||||
sudo nmcli n off
|
|
||||||
|
|
||||||
echo 'Turning on network manager'
|
|
||||||
sudo nmcli n on
|
|
||||||
|
|
||||||
echo 'Changing interface mode to managed'
|
|
||||||
sudo iwconfig $wifi_device mode managed
|
|
||||||
|
|
||||||
echo 'Restarting networking stack'
|
|
||||||
sudo systemctl restart networking
|
|
||||||
|
|
||||||
iwconfig
|
|
||||||
|
|
||||||
echo -e "\nDone~ ^w^\n"
|
|
||||||
@@ -1,11 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
[ "root" != "$USER" ] && exec sudo $0 "$@"
|
|
||||||
|
|
||||||
webdir=/var/www
|
|
||||||
www_group=www-data
|
|
||||||
userfriend=princesspi
|
|
||||||
|
|
||||||
find "$webdir" -type d -exec chmod 775 {} \;
|
|
||||||
find "$webdir" -type f -exec chmod 664 {} \;
|
|
||||||
find "$webdir" -type f -iname "*.sh" -exec chmod 775 {} \;
|
|
||||||
chown -R $userfriend:$www_group "$webdir"
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e # bitchass cant be trusted without handholding
|
|
||||||
exec 2>/dev/null # fookin thing gonna be error city bec i cbf so null dem
|
|
||||||
|
|
||||||
echo "Fixan ya fuckin .ssh perms you useless fagat"
|
|
||||||
|
|
||||||
# if ~/.ssh dont exist, maek it
|
|
||||||
if [ ! -d ~/.ssh ]; then
|
|
||||||
echo "bitch u dont even have a fuckin ~/.ssh lemme make dat for you fraggot"
|
|
||||||
mkdir -p ~/.ssh # -p for error control/happydoll
|
|
||||||
fi
|
|
||||||
|
|
||||||
# ~/.ssh dir perms
|
|
||||||
echo "fixin perms on ~/.ssh because you're too dipshitted to do it yourself"
|
|
||||||
chmod 700 ~/.ssh
|
|
||||||
|
|
||||||
# privkey perms
|
|
||||||
echo "now im fixin perms on ya asshole private keys you are an embarassmebt to security"
|
|
||||||
chmod 600 ~/.ssh/id_rsa ~/.ssh/id_ed25519 ~/.ssh/config ~/.ssh/id_edchdsa
|
|
||||||
|
|
||||||
# public and less sensititve fiels perms
|
|
||||||
echo "now im fixin da perms on less sensitive files ig FUCK YOU"
|
|
||||||
chmod 644 ~/.ssh/authorized_keys ~/.ssh/known_hosts ~/.ssh/*.pub
|
|
||||||
|
|
||||||
echo "OK FAGGOT IM FINISHED"
|
|
||||||
echo "NEVER SPEAK OF THIS SHAME, FAGGOT"
|
|
||||||
|
|
||||||
exit 0 # always a friendly exit
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# usage:
|
|
||||||
## friendlyfriend [int seconds delay]
|
|
||||||
## friendlyfriend 30
|
|
||||||
|
|
||||||
if [ -z "$1" ]; then
|
|
||||||
sleep_seconds=5
|
|
||||||
else
|
|
||||||
sleep_seconds=$1
|
|
||||||
fi
|
|
||||||
|
|
||||||
while (true); do
|
|
||||||
clear
|
|
||||||
ponysay $(polygen /usr/share/polygen/eng/pornsite.grm | awk '{print $3}')
|
|
||||||
sleep $sleep_seconds
|
|
||||||
done
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# packages required: git trufflehog gitsecrets
|
|
||||||
|
|
||||||
github='https://github.com/InfoSecREDD/'
|
|
||||||
|
|
||||||
out_dir="$PWD/redd_repos"
|
|
||||||
mkdir -p "$out_dir"
|
|
||||||
|
|
||||||
repos=("DWipe" "wifipineapplepager-payloads" "ThreatVis" "RadioRef-Export" "REDDs-PCAP-Uploader" "Uptime-Monitor" "Uni-Adblock" "PolyZip" "CVE-Discord-Notify" "shlt-plugins" "DarkGPT-Lite" "RPT-Installer" "YOURLS-Security-Audit-Plugin" "YOURLS-IP-Info" "InfoSecREDD.github.io" "sharkjack-payloads" "ExPW" "DeLookup" "CheckSim" "sb" "REPG-Community-Payloads" "BTSM-Payloads" "Flip-pi" "InvisInk-Encoder" "REPG" "NET-UP" "Adafruit_WebSerial_ESPTool" "BadPS" "omg-payloads" "k" "Flipper" "REDD-Demo" "SecF0EncKey" "SIN-Main" "sj-webui-patch" "MHS35-lcd-64bit-rpi" "verifymd5" "proxmark3" "DHunter" "termux-pm3-helper" "Proxmark3-Amiibo-Emulate" "Termux-Helper-Script" "NFC-Cloner" "Handshake-Transfer" "shark-files" "rtl8812au" "SharkLib" "rtl8812AU_8821AU_linux" "NET-UP-modules" "boot-dev" "RPi-Tweaks" "auto-ssh" "HoppEye" "bashbunny-payloads" "CPUMINER" "bash-no-ip-updater")
|
|
||||||
|
|
||||||
# if [ -d "$out_dir" ]; then
|
|
||||||
# printf "deleting existing $out_dir..."
|
|
||||||
# rm -rf "$out_dir" > /dev/null 2>&1
|
|
||||||
# printf "$?\n"
|
|
||||||
#
|
|
||||||
# printf "remaking $out_dir..."
|
|
||||||
# mkdir -p "$out_dir"
|
|
||||||
# printf "$?\n"
|
|
||||||
# fi
|
|
||||||
#
|
|
||||||
# for repo in "${repos[@]}"; do
|
|
||||||
# printf "cloning $repo into $out_dir/$repo..."
|
|
||||||
# git clone --recursive "$github/$repo" "$out_dir/$repo" > /dev/null 2>&1
|
|
||||||
# printf "$?\n"
|
|
||||||
# done
|
|
||||||
|
|
||||||
for repo in "${repos[@]}"; do
|
|
||||||
cd "$out_dir/$repo"
|
|
||||||
trufflehog git file://. --relative
|
|
||||||
gitleaks detect -v
|
|
||||||
cd -
|
|
||||||
done
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e # die on any error
|
|
||||||
|
|
||||||
# get current directory name without the path
|
|
||||||
reponame=${PWD##*/}
|
|
||||||
|
|
||||||
# init to main branch (github default)
|
|
||||||
git init -b main
|
|
||||||
git add .
|
|
||||||
git commit -m "initial commit via gitinitshit"
|
|
||||||
|
|
||||||
# use github cli to create repo with the dir name
|
|
||||||
gh repo create "$thisdirname" --public --source=. --remote=upstream --push
|
|
||||||
|
|
||||||
# print git link and url
|
|
||||||
git remote -v | sed -n -e 1p | awk '{print "\ngit link:", $2; gsub(".git", "", $2); print "repo url:", $2, "\n"}'
|
|
||||||
@@ -1,16 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e # fail on error
|
|
||||||
|
|
||||||
if [ -f './version.txt' ]; then
|
|
||||||
message=$(cat './version.txt')
|
|
||||||
else
|
|
||||||
if [ -z "$1" ]; then
|
|
||||||
message="$(annoy_the_fuck_out_of_commit_message_nerds)"
|
|
||||||
else
|
|
||||||
message="$*"
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
|
|
||||||
git add .
|
|
||||||
git commit -m "$message"
|
|
||||||
git push
|
|
||||||
@@ -1,72 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# sync a local git repo with a remote one over ssh
|
|
||||||
# usage: gitsync <remote_host> <remote_dir>
|
|
||||||
# defaults pi3 and /var/www/html/Media-Viewer
|
|
||||||
|
|
||||||
# handle defaultz
|
|
||||||
handle_args () {
|
|
||||||
if [ -z $1 ]; then
|
|
||||||
remote_host="pi3"
|
|
||||||
else
|
|
||||||
remote_host="$1"
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ -z $2 ]; then
|
|
||||||
remote_dir="/var/www/html/Media-Viewer"
|
|
||||||
else
|
|
||||||
remote_dir="$2"
|
|
||||||
fi
|
|
||||||
}
|
|
||||||
|
|
||||||
syncstatus () {
|
|
||||||
# view local and remote status before proceeding
|
|
||||||
echo -e "\nLOCAL status\n"
|
|
||||||
git status
|
|
||||||
|
|
||||||
echo -e "\nREMOTE status\n"
|
|
||||||
ssh $remote_host "/bin/bash -c \"git -C $remote_dir status\""
|
|
||||||
}
|
|
||||||
|
|
||||||
# synchronize git repos on local and remote
|
|
||||||
gitsync () {
|
|
||||||
echo "INFO | Starting gitsync"
|
|
||||||
|
|
||||||
# run on remote
|
|
||||||
ssh $remote_host "git -C \"$remote_dir\" pull"
|
|
||||||
echo "REMOTE | Finished git pull on $remote_host:$remote_dir" $?
|
|
||||||
|
|
||||||
ssh $remote_host "git -C \"$remote_dir\" add ."
|
|
||||||
echo "REMOTE | Finished git adding on $remote_host:$remote_dir" $?
|
|
||||||
|
|
||||||
ssh $remote_host "git -C \"$remote_dir\" commit -m \"autosync at $(date +%s)\""
|
|
||||||
echo "REMOTE | Finished git commit on $remote_host:$remote_dir" $?
|
|
||||||
|
|
||||||
ssh $remote_host "git -C \"$remote_dir\" push"
|
|
||||||
echo "REMOTE | Finished git push on $remote_host:$remote_dir" $?
|
|
||||||
|
|
||||||
ssh $remote_host "git -C \"$remote_dir\" status"
|
|
||||||
echo "REMOTE | Finished git status on $remote_host:$remote_dir" $?
|
|
||||||
|
|
||||||
# run on local
|
|
||||||
git pull
|
|
||||||
echo "LOCAL | Finished git pulling" $?
|
|
||||||
|
|
||||||
git add .
|
|
||||||
echo "LOCAL | Finished git adding" $?
|
|
||||||
|
|
||||||
git commit -m "autosync at $(date +%s)"
|
|
||||||
echo "LOCAL | Finished git comitting" $?
|
|
||||||
|
|
||||||
git push
|
|
||||||
echo "LOCAL | Finished git pushing" $?
|
|
||||||
|
|
||||||
git status
|
|
||||||
echo "LOCAL | Finished git status" $?
|
|
||||||
|
|
||||||
echo "INFO | Finished gitsync"
|
|
||||||
}
|
|
||||||
|
|
||||||
handle_args
|
|
||||||
syncstatus
|
|
||||||
gitsync
|
|
||||||
syncstatus
|
|
||||||
@@ -1,24 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
set -e # we do noot tolerate failure here
|
|
||||||
|
|
||||||
# aint got no time for no bs
|
|
||||||
if [ -z "$1" ]; then
|
|
||||||
echo -e "ERROR\nUsage: hash_cred_check.sh <email or phone number>"
|
|
||||||
exit 1 # fail with error
|
|
||||||
fi
|
|
||||||
|
|
||||||
# 256 bits of random shit, encoded as base64
|
|
||||||
salt="$(openssl rand -base64 32)"
|
|
||||||
|
|
||||||
# set credential
|
|
||||||
credential="$1"
|
|
||||||
|
|
||||||
# output hex bytes after doi one hell of a argon2id fuckery
|
|
||||||
hash=$(echo -n "$credential" | argon2 "$(base64 -d <<< $salt)" -id -t 8 -m 19 -p 2 -r)
|
|
||||||
|
|
||||||
echo "Hash: $hash"
|
|
||||||
echo "Salt: $salt"
|
|
||||||
echo "Credential: $credential"
|
|
||||||
echo 'Protocol: echo -n "$credential" | argon2 "$(base64 -d <<< $salt)" -id -t 8 -m 19 -p 2 -r'
|
|
||||||
echo
|
|
||||||
echo "Verify with: hash_cred_verify.sh '$credential' '$salt' '$hash'"
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user