Compare commits

..

1 Commits

Author SHA1 Message Date
PrincessPi 6a2a10df79 Initial commit 2026-05-27 00:57:31 +00:00
134 changed files with 123 additions and 6193 deletions
-13
View File
@@ -1,13 +0,0 @@
{
"version": 1,
"isRoot": true,
"tools": {
"haveibeenpwned-downloader": {
"version": "0.5.25",
"commands": [
"haveibeenpwned-downloader"
],
"rollForward": false
}
}
}
-11
View File
@@ -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
-4
View File
@@ -1,4 +0,0 @@
webhook.txt
tag.txt
*.tmp
*.csv
-218
View File
@@ -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
-2
View File
@@ -1,2 +0,0 @@
[remoteservers]
someserver ansible_user=root ansible_host=1.1.1.1
-10
View File
@@ -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
-230
View File
@@ -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'
-48
View File
@@ -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'
-87
View File
@@ -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
-84
View File
@@ -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
+121
View File
@@ -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.
-123
View File
@@ -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>
-3
View File
@@ -1,3 +0,0 @@
0 8 * * * chkrootkit -q
0 11 * * 0 lynis -q
0 0 * * * apt update; apt upgrade -y
-148
View File
@@ -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
+2 -102
View File
@@ -1,103 +1,3 @@
* General Guides and Scripts for:
* Ubuntu Server LAMP (20.04 LTS)
* Dark Web Hosting (LAMP on 20.04 LTS)
* General Windows 10 and mobile security guide
# general-scripts-and-system-ssssssetup
Install customscripts on linux
with full upgrade and package install
```bash
script=/tmp/install_script.sh && curl -s https://raw.githubusercontent.com/PrincessPi3/general-scripts-and-system-ssssssetup/refs/heads/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://raw.githubusercontent.com/PrincessPi3/general-scripts-and-system-ssssssetup/refs/heads/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`
#### 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`
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
general scripts and shit
-115
View File
@@ -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

-9
View File
@@ -1,9 +0,0 @@
# Windows-Repair.ps1 Usage:
1. Open PowerShell as Administrator via these keyboard shotcuts in sequence
1. WIN+X
2. ALT+A
3. ALT+Y
2. Run
```powershell
powershell.exe -Command "Invoke-WebRequest -Uri `"https://raw.githubusercontent.com/PrincessPi3/general-scripts-and-system-ssssssetup/refs/heads/main/Windows-Scripts/windows-repair.ps1`" -OutFile `"$env:TEMP\windows-repair.ps1`"" && powershell.exe -ExecutionPolicy Bypass -File "$env:TEMP\windows-repair.ps1"
```
-3
View File
@@ -1,3 +0,0 @@
while($True) {
nmap -p22 -sV --open 10.0.0.0/24 -oG -
}
-61
View File
@@ -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
Restart-Computer # -Force
@@ -1 +0,0 @@
donkeydicks:pope:
-7
View File
@@ -1,7 +0,0 @@
param(
# powershell is factually gay idkl why its such a shit
[Parameter(Mandatory=$True, Position=0)]
[string]$Filename
)
# apng is far hjigher quality and also preserves transparancy :activated:
ffmpeg -i "$Filename" -plays 0 -f apng "$Filename.apng"
-150
View File
@@ -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
-17
View File
@@ -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"
-20
View File
@@ -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
-6
View File
@@ -1,6 +0,0 @@
param (
[Parameter(Mandatory=$true)]
[string]$infile
)
Invoke-Expression "$PSScriptRoot\winhash.ps1 $infile MD5"
-25
View File
@@ -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++;
}
-74
View File
@@ -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"
-20
View File
@@ -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
}
-6
View File
@@ -1,6 +0,0 @@
param (
[Parameter(Mandatory=$true)]
[string]$infile
)
Invoke-Expression "$PSScriptRoot\winhash.ps1 $infile SHA1"
-6
View File
@@ -1,6 +0,0 @@
param (
[Parameter(Mandatory=$true)]
[string]$infile
)
Invoke-Expression "$PSScriptRoot\winhash.ps1 $infile SHA256"
-6
View File
@@ -1,6 +0,0 @@
param (
[Parameter(Mandatory=$true)]
[string]$infile
)
Invoke-Expression "$PSScriptRoot\winhash.ps1 $infile SHA384"
-6
View File
@@ -1,6 +0,0 @@
param (
[Parameter(Mandatory=$true)]
[string]$infile
)
Invoke-Expression "$PSScriptRoot\winhash.ps1 $infile SHA512"
-11
View File
@@ -1,11 +0,0 @@
param(
[string]
$session = 'pi3'
)
while($True) {
ssh $session
echo "Waiting 5 Seconds..."
sleep 5
wait-on-host -hostname $session
}
-5
View File
@@ -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
-39
View File
@@ -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"
-10
View File
@@ -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"
-7
View File
@@ -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"
-80
View File
@@ -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++
}
-9
View File
@@ -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"
-21
View File
@@ -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"
-37
View File
@@ -1,37 +0,0 @@
# Usage:
# Open PowerShell as Administrator
# win+x
# alt+a
# alt+y
# Run:
# powershell.exe -Command "Invoke-WebRequest -Uri `"https://raw.githubusercontent.com/PrincessPi3/general-scripts-and-system-ssssssetup/refs/heads/main/Windows-Scripts/windows-repair.ps1`" -OutFile `"$env:TEMP\windows-repair.ps1`"" && powershell.exe -ExecutionPolicy Bypass -File "$env:TEMP\windows-repair.ps1"
# Check for administrator privileges
if (-not ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
# Restart with elevated privileges
Start-Process powershell.exe -Verb RunAs -ArgumentList "-File `"$($MyInvocation.MyCommand.Path)`""
exit
}
Write-Host "`nFIXING WINDOWS FULL STYLE`n"
Write-Host "ABORTING ANY SCHEDULED SHUTDOWN"
shutdown /a # cmd abort scheduled shutdowns
Write-Host "RUNNING WINDOWS MALICIOUS SOFTWARE REMOVAL TOOL (mrt)"
mrt # cmd malicious software removal tool
Write-Host "RUNNING SYSTEM FILE CHECKER (sfc)"
sfc /scannow # cmd system file checker, retreives and replaces bad system files
Write-Host "RUNNING DISM"
DISM /Online /Cleanup-Image /RestoreHealth # powershell checks image and replaces bad files
Write-Host "SCHEDULING OFFLINE CHECK DISK AND REPAIR OF C: (chkdsk)"
Write-Host y | chkdsk /f /r C: # cmd checks C drive after reboot to waste time and fix errors (noninteractive)
Write-Host "SCHEDULING WINDOWS DEFENDER OFFLINE SCAN"
Start-MpWDOScan # powershell starts Windows Defender Offline Scan after reboot
Write-Host "`nREBOOTING IN 5 MINUTES`n"
shutdown /r /t 300
-38
View File
@@ -1,38 +0,0 @@
# Usage:
## .\winhash.ps1 <FILE> <ALGO>
## Algos Supported:
### MD5
### SHA1
### SHA256
### SHA384
### SHA512
## Example:
### .\winhash.ps1 sillyfilly.bin SHA256
## Outputs to terminal and to a text file
### Text file name format <input filepath>.<unix epoch microseconds>.<hashing algorithm>.txt
param (
[Parameter(Mandatory=$true)] # prompt for input if not specified via cli
[string]$infile,
[Parameter(Mandatory=$true)] # this 1 2 :pope:
[string]$algo
)
function Get-UnixMicroseconds {
$unixEpoch = [DateTimeOffset]'1970-01-01T00:00:00Z' # unix epoch constant
$currentTime = [DateTimeOffset]::UtcNow # current utc time
$timeDifferenceTicks = $currentTime.Ticks - $unixEpoch.Ticks # subtract current time from unix epoch constant in ticks
$microseconds = [Int64]($timeDifferenceTicks / 10) # use 64bit int, divide ticks by 10 to give microseconds
# I am literally using Unix microseconds because they are more fun than Unix seconds :pinkie:
return $microseconds
}
# jesus fuckin analbeads the selection of hash algos in powershell is weird and limited
# probably because Bill Gates and Satya Nadella get together with the other C-suite executives
# and hypergoon to leagelese in clickwrap agreements that absolves them of liability and
# lets them sell our private data and other assorted dickpics or sumtin idk man lmao
$hash = $(Get-FileHash -Path $infile -Algorithm $algo | Format-List) # do da fookin hashin right dafucc here
echo $hash # show user
echo $hash > "$infile.$(Get-UnixMicroseconds).$algo.txt" # make the txt file
View File
-18
View File
@@ -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)"
-9
View File
@@ -1,9 +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"
```
View File
-18
View File
@@ -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
-56
View File
@@ -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"
-13
View File
@@ -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
-42
View File
@@ -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
-15
View File
@@ -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";
-61
View File
@@ -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
-8
View File
@@ -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
-103
View File
@@ -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"
-57
View File
@@ -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)
-69
View File
@@ -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
-5
View File
@@ -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
-23
View File
@@ -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
-58
View File
@@ -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..."
-40
View File
@@ -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"
-55
View File
@@ -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
-22
View File
@@ -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>
-267
View File
@@ -1,267 +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
printf '\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
checkcode $?
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
-15
View File
@@ -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
-13
View File
@@ -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
-23
View File
@@ -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;}}/*****####*******!!=;:~
~::==!!!**********!!!==::-
.,~~;;;========;;;:~-.
..,--------,*/
-63
View File
@@ -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
-8
View File
@@ -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"
-40
View File
@@ -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
-14
View File
@@ -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
-10
View File
@@ -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"
-16
View 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
-49
View File
@@ -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"
-11
View File
@@ -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"
-28
View File
@@ -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
-16
View File
@@ -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
-16
View File
@@ -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"}'
-16
View File
@@ -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
-72
View File
@@ -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
-22
View File
@@ -1,22 +0,0 @@
#!/bin/bash
max=65535 # FFFF
txtfile="/mnt/e/2025-12-17_hibp_sha1.txt"
outdir="/mnt/e/hibp_parsed"
if [ ! -d "$outdir" ]; then
echo "creating $outdir"
mkdir "$outdir"
else
echo "clearing $outdir"
rm -f "$outdir/*"
fi
# remove the carriage returns from file
# sed -i "s/\x0d//g" "$txtfile"
for ((i = 0; i <= $max; i++)); do
HEX_VAL=$(printf "%04X" $i) # %04X to give padding 0s up to four
echo "$HEX_VAL"
rg -N "^$HEX_VAL" "$txtfile" >> "$outdir/$HEX_VAL.txt"
echo $?
done
-49
View File
@@ -1,49 +0,0 @@
#!/bin/bash
# from https://askubuntu.com/questions/3299/how-to-run-cron-job-when-network-is-up
# usage in root cron
## @reboot bash /usr/share/customscripts/ifnet "/usr/share/customscripts/webhook bootup"
# Configurable values
## How many times we should check if we're online - this prevents infinite looping
MAX_CHECKS=10
## Seconds to sleep per loop
SLEEP_SECONDS=10
## error log
ERROR_LOG="/var/log/cron.error.log"
## any high availability host
HA_HOST="www.cloudflare.com"
# do da checcc
check_online () {
# check if HA_HOST is reachable, echo 1 if online 0 if offline
netcat -z -w 5 $HA_HOST 80 2>/dev/null && echo 1 || echo 0
}
# initial values
## Initial starting value for checks
CHECKS=1
## Initial check to see if we are online
IS_ONLINE=$(check_online)
# Loop while we're not online.
while [[ $IS_ONLINE -eq 0 ]]; do
echo "$HA_HOST unreachable, loop $CHECKS/$MAX_CHECKS every $SLEEP_SECONDS seconds to run command \"$1\"" # only shows on manual run
sleep $SLEEP_SECONDS # eepies
IS_ONLINE=$(check_online) # recheck and update IS_ONLINE
CHECKS=$(($CHECKS + 1))
if [ $CHECKS -gt $MAX_CHECKS ]; then # if checks is over max, break loop
break
fi
done
# only reach this point after being checked in loop, check for 0 again for failure mode
if [[ $IS_ONLINE -eq 0 ]]; then
# We never were able to get online. Kill script.
sudo bash -c "echo \"$(date) | Failed to connect to $HA_HOST after $MAX_CHECKS attempts of $SLEEP_SECONDS seconds\" | tee -a $ERROR_LOG"
exit
fi
sudo bash $1 2>> $ERROR_LOG # execute the bash script and log errors to the error log
-132
View File
@@ -1,132 +0,0 @@
#!/bin/bash
# todo:
## x environment checks for webhook, xz-tools, and pishrink
### install if not found
## sanity checks in cleanup error trap to make sure nothing is wrongly deleted
## x ERR/TERMINATE traps
### x NO cleanup trap on EXIT
## x finish the pi query
## x add filename query
set -euo pipefail # fail on fuckups to iterate fasterrr :pope: strict fuk u mode :3
timestamp="$(date +%Y-%m-%d-%H%M-%Z)"
# disk=""
# log="${timestamp}_img_dump_testin.log"
# img_name="${timestamp}_Kali-Pi5-1TB-Working.img"
check_command() {
if ! command -v "$1" >/dev/null 2>&1; then
# output as error to stderr, and append to log only if defined
echo "Required command '$1' not found. Install it and retry." >&2
if [ -n "${log:-}" ]; then
echo "Required command '$1' not found. Install it and retry." >>"$log"
fi
exit 1
fi
}
# check da needed cmds~
for cmd in webhook xz pishrink sha256sum sudo lsblk dd; do
check_command "$cmd"
done
# trap function cleanup
cleanup () {
webhook "$0 errored! Cleaning up! seconds: $SECONDS line: $LINENO command: $BASH_COMMAND" true
# supress errors if they not there
# to save me from testing each one or writing a fun :poe:
for file in "$img_name" "$img_name.sha256" "$img_name.xz" "$img_name.xz.sha256" "$log"; do
if [ -f "$file" ]; then
echo "Deleting $file"
sudo rm -f "$file" 2>/dev/null
fi
done
}
# cleanup any errant files on error/termination
## disable dis shit fo now
# trap cleanup ERR
# trap cleanup SIGINT
# trap cleanup SIGTERM
echo -e "\n\n\nSTARTING DUMP OPS\n\n\n"
# get disk
lsblk
read -p "Enter Disk Name (ex. sda, sdb no /dev or anything else) " disk_choice
if [ -z "${disk_choice:-}" ]; then
echo "ERROR: No disk entered." >&2
exit 1
fi
disk="/dev/$disk_choice"
if [ ! -e "$disk" ]; then
echo "ERROR: $disk is not a device." >&2
exit 1
fi
read -p "For Raspberry Pi? y\n default y" picheck
# set default to 'y' when empty
picheck=${picheck:-y}
# for when ask for tag
read -p "Input File Tag" filetag
# sanity check it
if [ -z "$filetag" ]; then
echo "ERROR! File Tag is Empty!" >&2
exit 1
fi
log="${timestamp}_${filetag}.log"
echo > "$log" # initialize to empty
img_name="${timestamp}_${filetag}.img"
clear
# logging optinos to log file
webhook "Selections! filetag: $filetag disk: $disk picheck: $picheck log: $log img_name: $img_name (Script Has Run $SECONDS Seconds Date $(date))" | tee -a "$log"
webhook "runnan raw dd img on $disk at to $img_name using 4M bs size (Script Has Run $SECONDS Seconds Date $(date))"
sudo dd if="$disk" of="$img_name" status=progress bs=4M 2>&1 | tee -a "$log"
webhook "Changing perms abd ownership on $img_name (Script has run $SECONDS seconds date $(date))"
sudo chown princesspi:princesspi "$img_name"
sudo chmod 660 "$img_name"
# fuckin nope rn
# webhook "generating sha256 checksum of $img_name (from $disk) to $img_name.sha256 (Script Has Run $SECONDS Seconds Date $(date))"
# sha256sum "$img_name" | tee -a "$img_name.sha256"
if [[ "$picheck" =~ [nN] ]]; then
webhook "Doing non-pi xz compression on $img_name into $img_name.xz (Script Has Run $SECONDS Seconds Date $(date))"
xz -v -k "$img_name" | tee -a "$log" # keeping for now so fiddle wit later
else
# pishrink
## -v verbose
## -r use advanced filesystem repair option if the normal one fails
## -Z xz compression
## -a compress using multiple cores
## -n disable update check
## disavble upgrade check
webhook "Doing pi compress using pishrink from $img_name ($disk) to $img_name.xz (Script Has Run $SECONDS Seconds Date $(date))"
sudo pishrink -v -r -Z -a -n "$img_name" | tee -a "$log"
fi
# fuck yourself
# webhook "testing xz integrity: $img_name.xz (Script Has Run $SECONDS Seconds Date $(date))"
# xz -t -v "$img_name.xz" | tee -a "$log"
# webhook "xz integrity response code: $?"
msg="Generating sha256 checksums of $img_name.xz to $img_name.xz.sha256"
webhook "$msg"
echo "$msg" >>"$log"
webhook "testing xz integrity: $img_name.xz (Script Has Run $SECONDS Seconds Date $(date))"
sha256sum "$img_name.xz" > "$img_name.xz.sha256"
# do not fuckin deletee this shit till it works right
# if [ -f "$img_name" ]; then
# webhook "testing xz integrity: $img_name.xz (Script Has Run $SECONDS Seconds Date $(date))"
# webhook "$img_name still there! Deleting by force!"
# sudo rm -f "$img_name"
# fi
webhook "\n\n\nFUCKING FINAALLY ITS OVER\n\n\n\t$SECONDS Seconds Elapsed\n\tDateTime Started: $timestamp DateTime Finished: $(date +%Y-%m-%d-%H%M-%Z)"
-144
View File
@@ -1,144 +0,0 @@
#!/bin/bash
# usage: by its self or with nuke
# bash improved_file_management.sh
# bash improved_file_management.sh nuke
## "nuke" is not case sensitive
start_date="$(date)"
args="$@"
backup_dir="/mnt/d/Anbernic_Research_Tinkering_Save"
#backup_dir="/mnt/c/Users/human/Downloads/tint"
#vbackup_dir="/mnt/c/Users/human/Downloads/tint"
error_log="${backup_dir}/error.log" # errror log path
cd "$backup_dir" # slide on in
# make errros get logged and also displayed to the terminal
exec 2> >(tee -a "$error_log" >&2)
# 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
check_error_log () {
if [ -f "$error_log" ]; then
echo -e "${GREEN}Found $error_log clearing at $(date) With $SECONDS Elapsed At Line Number $LINENO${RESET}"
echo > "$error_log" # initialize as empty
else
echo -e "${GREEN}No $error_log fiound, creating at $(date) With $SECONDS Elapsed At Line Number $LINENO${RESET}"
touch "$error_log" # create and initialize
fi
}
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
echo -e "\n${GREEN}Environment Checks GOOD!${RESET}\n"
}
greet () {
echo -e "\n\n\n${GREEN}WELCOME TO DURABLE, PROVABLE FILE HANDLING${RESET}\n\n\n"
}
when_done () {
echo -e "\n\n\n${GREEN}DONE :3 nyaa~!${RESET}\n\n\n"
}
delete_sha256_files () {
echo -e "${GREEN}Nuking all .sha256 files in $backup_dir${RESET}\n"
find . -type f -name "*.sha256" -not -path "*.git*" -delete
}
verify_sha256_files() {
echo -e "${GREEN}verifying file's checksums${RESET}"
local file
local failed=0
find "${1:-.}" -type f -name '*.sha256' -not -path "*.git*" -print0 |
while IFS= read -r -d '' file; do
echo "Checking: $file"
if ! sha256sum -c "$file"; then
# here is where i can handle bad checksums
echo -e "FAILED: $file" >&2
failed=1
fi
done
return "$failed"
}
generate_sha256_checksums () {
# make any new checksums
find . -type f -not -path "*.git*" -exec sh -c '
for file; do
if [[ "$file" =~ .sha256 ]]; then
echo "Skipping $file"
continue
else
echo -e "${GREEN}making checksum of $file${RESET}"
sha256sum "$file" | tee "$file.sha256"
fi
done
' sh {} + \; # idk what this hippie bullshit voodoo witchcraft this syntax is, kill nme now
}
do_git () {
if [ ! -d ".git" ]; then
echo -e "${GREEN}Not a Git Directory, initiating a git repo${RESET}"
git init
git add .
git commit -m "First Autoinit at $(date)"
else
echo -e "${GREEN}archiving everything to git${RESET}"
git add .
git commit -m "Autoarchive at $(date)"
fi
}
# to trigger an archival via restic
run_backup () {
echo -e "\n\n${GREEN}Starting Restic Backup${RESET}\n\n"
# unholy call restic script from powershell
pwsh.exe -File "D:\Anbernic-Hackin-Archive_restic_backup.ps1" # do da restic backup ps1
}
# shutdown by force of powershell huehhuehue
box_force_shutdown () {
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
}
greet # welcome msg
environment_checks # test environment for working
if [[ "$args" =~ nuke ]]; then
delete_sha256_files # delete all *.sha256 files
fi
check_error_log # verify error log faggot
while true; do # do an infinite loop to keep em all running and operating at all times :3
verify_sha256_files # check files against their sha256 checksum
generate_sha256_checksums # create the checksums from the files to generate each file its own *.sha256 buddy \o/
do_git # archive for version controll
run_backup # do multiple redndant backups using restic
done
when_done # goodbye msg
-253
View File
@@ -1,253 +0,0 @@
#!/bin/bash
# install without upfate and package install
## script=/tmp/install_script.sh && curl -s https://raw.githubusercontent.com/PrincessPi3/general-scripts-and-system-ssssssetup/refs/heads/main/customscripts/install_script.sh > $script && chmod +x $script && $SHELL -c "$script" && $SHELL /usr/share/customscripts/configure_webhook.sh full && exec $SHELL
# install with package install
## script=/tmp/install_script.sh && curl -s https://raw.githubusercontent.com/PrincessPi3/general-scripts-and-system-ssssssetup/refs/heads/main/customscripts/install_script.sh > $script && chmod +x $script && $SHELL -c "$script full" && $SHELL /usr/share/customscripts/configure_webhook.sh full && exec $SHELL
# set -e # make sure da silly thing dont continue when there be errorZ
# configs
gitRepo='https://github.com/PrincessPi3/general-scripts-and-system-ssssssetup.git'
tmpDir='/tmp/generalssss'
tmp_customscripts_dir="$tmpDir/customscripts"
finalDir='/usr/share/customscripts'
packages="7zip apache2 argon2 avahi-daemon btop build-essential byobu cargo cifs-utils clamav cmake cowsay cracklib-runtime detox docker.io exiftool fdupes ffuf gcc-arm-none-eabi grc gzip iotop iptraf-ng jq kpartx libnss-mdns libnewlib-arm-none-eabi librust-git2+openssl-probe-dev libstdc++-arm-none-eabi-newlib locales lynx net-tools nginx openssl php polygen polygen-data procps python3 python3-scapy resolvconf restic ripgrep samba screen seclists snapd thefuck unzip wget xrdp xxd xz-utils zip kali-linux-default"
# packages="grc kpartx openssl cracklib-runtime argon2 jq polygen polygen-data apache2 seclists cmake locales python3 build-essential gcc-arm-none-eabi libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib librust-git2+openssl-probe-dev cargo nginx build-essential cowsay iotop iptraf-ng btop screen byobu thefuck wget lynx zip unzip 7zip xz-utils gzip net-tools clamav php restic cifs-utils detox fdupes ripgrep avahi-daemon libnss-mdns xxd xrdp libimage-exiftool-perl kali-tools-hardware kali-tools-crypto-stego kali-tools-fuzzing kali-tools-bluetooth kali-tools-rfid kali-tools-sdr kali-tools-voip kali-tools-802-11 kali-tools-forensics samba procps snapd"
echo -e "\nSTARTING!\n\tUsing Shell $SHELL\n"
# ta get da right usermayhaps
if [[ -z $SUDO_USER ]]; then
echo -e "\nUsing User $USER\n"
username="$USER"
else
echo -n "\nUsing User $SUDO_USER\n"
username="$SUDO_USER"
fi
# home dir
userhome=/home/$username
# figure oot da sehell
# if [[ "$SHELL" =~ bash$ ]]; then
rcfile="$userhome/.bashrc"
# elif [[ "$SHELL" =~ zsh$ ]]; then
# rcfile="$userhome/.zshrc"
# else
# echo -e "Die: Unsupported Shell";
# exit 1
# fi
echo -e "\nusing rcfile $rcfile\n"
if [ ! -z "$1" ]; then
echo -e "\nFULL MODE SELECTED FULL UPGRADE AND INSTALL PACKAGES!\n"
# update and upgrade
echo -e "\nUpdating software lists\n"
sudo apt update
echo -e "\nDoin full-upgrade\n"
sudo apt full-upgrade -y
echo "installan packages"
echo -e "\nInstallan my packages\n"
sudo bash -c "apt install $packages -y"
# source $rcfile
# dotnet conditional install
# if [ ! $(which dotnet) ]; then
# echo -e "\ndotnet not found, installing\n"
# wget https://dot.net/v1/dotnet-install.sh -O /tmp/dotnet-install.sh
# chmod +x /tmp/dotnet-install.sh
# /tmp/dotnet-install.sh --channel STS # latest stable, optinoally LTS
# echo -e "## dotnet\nPATH=\$PATH:$userhome/.dotnet:$userhome/.dotnet/tools" >> $rcfile
# source $rcfile
# else
# echo -e "\ndotnet installed, skipping install of repo\n"
# source $rcfile
# fi
### dotnet
### haveibeenpwned-downloader
# if ! which haveibeenpwned-downloader; then
# echo -e "\nhaveibeenpwned-downloader not found, installing with dotnet\n"
# dotnet tool install --create-manifest-if-needed haveibeenpwned-downloader
# else
# echo -e "\nhaveibeenpwned-downloader installed, skipping install\n"
# fi
# homebrew
# if [ ! $(which brew) ]; then
# ## install homebrew
# echo -e "\nlinuxbrew not found, installing\n"
# bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
# test -d /home/linuxbrew/.linuxbrew && eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
# ### add to rcfile
# if ! grep -q 'linuxbrew' $rcfile; then
# # echo "adding linuxbrew to $rcfile"
# # echo "# linuxbrew (homebrew/brew)" >> $rcfile
# # echo "eval \"\$($(brew --prefix)/bin/brew shellenv)\"" >> $rcfile
# else
# echo "linuxbrew already in $rcfile skipping"
# fi
#
# # source $rcfile
# else
# echo -e "\nlinuxbrew installed, skipping install\n"
# # source $rcfile
# fi
# ### install ponysay
# if [ ! $(which ponysay) ]; then
# echo -e "\nponysay not fonud, installiing\n"
# brew install ponysay
# if ! grep 'ponysay fix' $rcfile; then
# # echo "adding ponysay fix to $rcfile"
# # echo -e "# ponysay fix\nexport PYTHONWARNINGS=ignore::SyntaxWarning" >> $rcfile
# # source $rcfile
# else
# # echo "ponysay fix already in $rcfile skipping"
# # source $rcfile
# fi
# else
# echo -e "\nponysay already installed, skipping\n"
# fi
# cargo
## oniux
echo -e "\nINSTALLIN TOR ONIUX\n"
if [ -f /usr/local/bin/oniux ]; then
echo -e "\nexisting oniux found, skipping\n"
else
echo -e "\nexisting oniux not found, installing\n"
cargo install --git https://gitlab.torproject.org/tpo/core/oniux --tag v0.6.1 oniux
fi
else
echo -e "\nskipping package install\n"
fi
# get the existing tag and webhooks if any
if [ -f $finalDir/tag.txt ]; then
echo -e "\nFound existing tag.txt, backing up\n"
cp $finalDir/tag.txt /tmp/tag.txt
else
echo -e "\nno existing tag.txt, skipping backup of it\n"
fi
# backup webhook if present
if [ -f $finalDir/webhook.txt ]; then
echo -e "\nFound existing webhook.txt, backing up\n"
cp $finalDir/webhook.txt /tmp/webhook.txt
else
echo -e "\nno existing webhook.txt, skipping backup of it\n"
fi
# clean up any exisiting repo dir
if [[ -d "$tmpDir" ]]; then
echo "\nCleaning Up Existing $tmpDir\n"
rm -rf "$tmpDir"
else
echo -e "\n$tmpDir not found, skipping deleting it\n"
fi
# clean up any existing install
if [[ -d "$finalDir" ]]; then
echo -e "\nCleaning Up Existing $finalDir\n"
sudo rm -rf "$finalDir"
else
echo -e "\n$finalDir not found, will create\n"
fi
# ddownload repo
echo -e "\nCloning Repo $gitRepo\n"
git clone $gitRepo $tmpDir --single-branch --depth 1
# donut
echo -e "\nCompiling donut\n"
gcc -o "$tmp_customscripts_dir/donut" "$tmp_customscripts_dir/donut.c" -lm # 2>/dev/null
# put the customscripts dir into place
echo -e "\nPlacing in $finalDir\n"
sudo mv "$tmp_customscripts_dir" "$finalDir"
# fix ownership
echo -e "\nChanging ownership of $finalDir and $userhome/Rice to $username:$username recursively\n"
sudo chown -R $username:$username "$finalDir"
sudo chown -R $username:$username $userhome/Rice
# fix perms
echo -e "\nSetting perms of $finalDir and contents to 775\n"
sudo chmod -R 775 "$finalDir"
# check if $finalDir is in $rcfile
grep -q $finalDir $rcfile
pathgrep=$?
if [ $pathgrep -eq 0 ]; then
echo -e "\n$finalDir Already in \$PATH Skipping Append\n"
fi
# else
# echo -e "\nAdding $finalDir to $username's \$PATH by Appending to $rcfile\n"
# echo -e "\n\n# automatically added by customscripts installer\nexport PATH=\"\$PATH:$finalDir\"" >> "$rcfile"
# fi
# install pishrink if not there
if [ ! -f /usr/local/bin/pishrink ]; then
echo -e "\npishrink not found, installing\n"
wget https://raw.githubusercontent.com/Drewsif/PiShrink/master/pishrink.sh
mv pishrink.sh pishrink
chmod +x pishrink
sudo mv pishrink /usr/local/bin
else
echo -e "\nPishrink already installed, skipping\n"
fi
# install ble.sh if not there
if [ ! -d $userhome/.local/share/blesh ]; then
# install ble.sh
echo -e "\nble.sh not found, installing\n"
cd /tmp
git clone --recursive --depth 1 --shallow-submodules --single-branch -b master https://github.com/akinomyoga/ble.sh.git
make -C ble.sh install PREFIX=~/.local
# echo '# ble.sh' >> $rcfile
# echo "source -- ~/.local/share/blesh/ble.sh" >> $rcfile
# source $rcfile
# exec "$SHELL"
fi
# else
# echo -e "\nble.sh already installed, skippping\n"
# source $rcfile
# fi
# appeend thefuck to rcfile if not present
grep -q thefuck $rcfile
thefuck_present=$?
if [ $thefuck_present -ne 0 ]; then
echo -e "\nthefuck alias not fonud in $rcfile, adding\n"
# echo -e "# thefuck\neval \$(thefuck --alias fuck)" >> $rcfile
# source $rcfile
else
echo -e "\nthefuck is already in $rcfile, skipping\n"
fi
# copy rice if not present
if [ ! -d $userhome/Rice ]; then
echo -e "\n$userhome/Rice not found, adding\n"
mv $tmpDir/Rice $userhome
else
echo -e "\nRice found not copying again\n"
fi
# cleanup
echo -e "\ncleaning up temp files\n"
## installer
sudo rm -f "$finalDir/install_script.sh"
rm /tmp/install_script.sh
## git repo
sudo rm -rf "$tmpDir"
## donut c file
rm -f "$tmp_customscripts_dir/donut.c"
if [ ! -z "$1" ]; then
echo -e "cleaning up apt"
sudo apt autoremove -y
# echo -e "\nrebooting in 3 minutes\n"
# sudo shutdown -r +3
fi
echo -e "\nDone with first stage\n"
-10
View File
@@ -1,10 +0,0 @@
#!/bin/bash
# linux method
sudo bash -c "echo c > /proc/sysrq-trigger"
# if survived, try bsd method
sudo sysctl debug.kdb.panic=1
# if still nothihg, try fork bomb lol
:(){ :|:& };:
# if STIL alive, throw a fit :3
echo "fuk u :angy:" >&2 # print to stderr because fuk u
exit 1 # angry exit
-2
View File
@@ -1,2 +0,0 @@
#!/bin/bash
< passes.txt parallel --block 10M -C 5 --pipe grep --count --max-count=1 --fixed-strings $1
-98
View File
@@ -1,98 +0,0 @@
#!/bin/bash
# usage:
## both quoted and unquoted commands work for oneshot mode~
### measure_performance my_command -with -args
### measure_performance "my_command -with -args"
## if $1 is a file, it will read as text and test the commands, one per line
### measure_performance path/to/file.txt
#### file.txt
#### rm -rf ~/Downloads
#### sleep 10
#### wget https://example.com/file.zip
#### unzip file.zip
# todo: calculate human readable sizes for mem, r and w
# glooboos
poll_seconds=2
logfile=/tmp/sillylog.tmp # can beee a temp fiel
input="$@" # da command as a string or as args
duration_microseconds=0
duration_seconds=0
csv_file="${input%.*}.csv"
test_cmd=""
start_seconds=$(date +%s)
# throw a fit if no args supplied
if [ -z "$1" ]; then
echo 'USAGE: measure_performance "string_command-with -args"'
exit 1
fi
# maek sure da log fileee DIESASDRGVWERT
if [ -f "$logfile" ]; then
rm -f "$logfile"
fi
# maek sure da log fileee DIESASDRGVWERT
if [ -f "$csv_file" ]; then
rm -f "$csv_file"
fi
measure_performance () {
if [ -f "$logfile" ]; then
rm -f "$logfile"
fi
# use microseconds for timing for ONE MILLION DOLLARS more times resolution
start_unixmicroseconds=$(date +"%s%6N") # get start microseconds fast as possible before run
# run the command with pidstart (-e)
eval "pidstat -h -T ALL -H -d -r -u $poll_seconds -e bash -c \"($test_cmd >/dev/null 2>&1)\" >> \"$logfile\""
ret=$? # get da return code
# calculate durations
end_unixmicroseconds=$(date +"%s%6N") # get dis fast for accuracy
duration_microseconds=$(($end_unixmicroseconds - $start_unixmicroseconds))
duration_seconds=$(($duration_microseconds / 1000000)) # seconds = microseconds / 1,000,000
if [ ! -f "$input" ]; then
echo "testing your gay littel command: $test_cmd"
# parse and show infos
cat "$logfile" | sed '/^#\|^$\|^Linux/d' | tr -s ' ' ',' | awk -F, '{ cpup += $8; memk += $13; memp += $14; rkbs += $15; wkbs += $15 } END { print "\nCPU:",cpup/NR,"\nMemory Usage (KiB):",memk/NR,"\nMemory Usage %:",memp/NR,"\nKiB Read Per Second:",rkbs/NR,"\nKiB Written Per Second:",wkbs/NR }'
# nao add da rest
echo -e "Duration Seconds: $duration_seconds\nDuration Microseconds: $duration_microseconds\nReturn Code: $ret"
else
elapsed_seconds=$((`date +%s` - $start_seconds))
# parse and appand dem 2 da csv
cat "$logfile" | sed -n '/^[0-9]/p' | tr -s ' ' ',' | awk -F, "{cpup+=\$8;memk+=\$13;memp=\$14;rkbs+=\$15;wkbs+=\$15}{print \"$position\",\",\",cpup/NR,\",\",memk/NR\",\",memp/NR,rkbs/NR,wkbs/NR,\"$duration_microseconds\",\",$elapsed_seconds\",\",\",\"$friendly_test_cmd\",\",\",\"$ret\"}" | tee -a "$csv_file"
fi
}
# main
## awk testarrrr
## cat /tmp/sillylog.tmp | sed '/^#\|^$\|^Linux/d' | tr -s ' ' ',' | awk -F, '{print "Time:",$1,"UID:",$2,"PID:",$3,"%usr:",$4,"%system:",$5,"%guest:",$6,"%wait:",$7,"%CPU:",$8,"CPU:",$9,"minflt/s:",$10,"majflt/s:",$11,"VSZ:",$12,"RSS:",$13,"%MEM:",$14,"kB_rd/s:",$15,"kB_wr/s:",$16,"kB_ccwr/s:",$17,"iodelay:",$18,"Command:",$19}'
## if oneshot mode
if [ ! -f "$input" ]; then
test_cmd="$(echo \"$input\" | sed 's/\ /_/g')"
echo $test_cmd
measure_performance
## if batch mode
else
# settans
len=$(wc -l "$input" | awk '{print $1}') # num of lines in da fiel
count=1
# add da csv headers to the results fiel
echo "0Position,CPU %,Memory (KiB),Memory %,KiB Read/Second,KiB Written/Second,Duration Microseconds,Command,Return Code" > "$csv_file"
cat "$input" | \
while read line; do
test_cmd="$line"
friendly_test_cmd=$(echo "$line" | tr -s ' ' '_')
position="$count/$len"
measure_performance
count=$(($count + 1))
done
fi
-12
View File
@@ -1,12 +0,0 @@
#!/bin/bash
if [[ ! -z $1 ]]; then
message="$1"
else
message="Something happening! Maybe a shutdown!"
fi
for pts in $(ls -q /dev/pts); do
if [[ "$pts" =~ ^[0-9]+$ ]] && [[ "/dev/pts/$pts" != "$(tty)" ]]; then
sudo echo -e "$message" > /dev/pts/$pts
fi
done
-85
View File
@@ -1,85 +0,0 @@
#!/bin/bash
# usage
# bash watch.sh /path/t/dir processname logfile
set -e
if [ -z $1 ]; then
dir='.'
else
dir=$1
fi
if [ -z $2 ]; then
process_name='none'
else
process_name=$2
fi
if [ ! -f $3 ]; then
log_name=/dev/null
else
log_name=$3
fi
# uptime
uptime_dirty=$(uptime | awk '{print $3,$4}')
uptime_cleaned=${uptime_dirty:0:-1}
# date and time (default date command)
# ex. Sat May 17 11:36:04 PM MDT 2025
date_time=$(date)
echo -e "Uptime: $uptime_cleaned\t\tTime: $date_time\n"
# list filenames ordered by size large to small
list_files=$(ls -lAhS $dir | awk '{print $9}')
eval "list_files_names=($list_files)"
# echo -e "\nda names\n${list_files_names[1]}\n\n"
# size (human) ordered by size large to small
list_human=$(ls -lAhS $dir | awk '{print $5}')
eval "list_files_human=($list_human)"
# echo -e "\nda humans\n${list_files_human[1]}\n\n"
# size (bytes) ordered by size large to small
list_bytes=$(du -d 1 $dir/* | awk '{print $1}' | sort -r -n)
eval "list_files_bytes=($list_bytes)"
# echo -e "\nda bytes\n${list_files_bytes[1]}\n\n"
echo -e "Size (h)\tBytes\tName"
count=0
for name in ${list_files_names[@]}; do
echo -e "${list_files_human[$count]}\t\t${list_files_bytes[$count]} \t$name"
count=$(($count + 1))
done
# pid
list_processes_pid=$(ps aux | grep $process_name | awk '{print $2}')
eval "list_processes_pid=($list_processes_pid)"
# echo -e "\nda pids\n${list_processes_pid[1]}\n\n"
# %CPU usage
list_processes_cpu=$(ps aux | grep $process_name | awk '{print $3}')
eval "list_processes_cpu=($list_processes_cpu)"
# echo -e "\nda cpu%\n${list_processes_cpu[1]}\n\n"
# %MEMORY usage
list_processes_mem=$(ps aux | grep $process_name | awk '{print $4}')
eval "list_processes_mem=($list_processes_mem)"
# echo -e "\nda mem%\n${list_processes_mem[1]}\n\n"
# process names
list_processes_name=$(ps aux | grep $process_name | awk '{print $12,$13,$14,$15,$16,$17,$18}' | sed 's/\s/_/g')
eval "list_processes_name=($list_processes_name)"
# echo -e "\nda name\n${list_processes_name[1]}\n\n"
echo -e "\nPID\t\t%MEM\t%CPU\tNAME"
count=0
for name in ${list_processes_name[@]}; do
echo -e "${list_processes_pid[$count]}\t\t${list_processes_mem[$count]}%\t${list_processes_cpu[$count]}%\t$name"
count=$(($count + 1))
done
echo -e "\n$log_name"
tail -10 $log_name
-29
View File
@@ -1,29 +0,0 @@
#!/bin/bash
if [ -z $1 ]; then
echo -e "Usage:\n\tmonitor_pid \"MESSAGE\""
exit
fi
pid=$1
clear
echo -e "\nMonitoring for process PID $pid to end"
# get da webhook tag
tag=$(cat /usr/share/customscripts/tag.txt)
# infinite loop
while [ 1 -eq 1 ]; do
# check for da pid
ps -q $pid > /dev/null
ret=$?
# check if the process exists via retcode of the ps -q $pid
if [ $ret -ne 0 ]; then
webhook "Process $pid Ended at $(date)!" true
echo "Process $pid Ended at $(date)!"
exit
fi
sleep 10
done
@@ -1,85 +0,0 @@
table main
{
adjective noun chaos operation
}
table adjective
{
async
blocking
brittle
cached
concurrent
deprecated
distributed
flaky
immutable
leaky
monolithic
mutable
racey
recursive
redundant
sandboxed
stale
thread-safe
undefined
unoptimized
}
table noun
{
api
build
cache
compiler
container
daemon
database
endpoint
function
heap
kernel
microservice
mutex
pipeline
process
queue
runtime
scheduler
stack
thread
}
table chaos
{
overflow
deadlock
panic
segfault
bottleneck
regression
refactor
hotfix
workaround
incident
}
table operation
{
added
removed
updated
fixed
corrected
tweaked
optimized
deleted
appended
concatanated
repaired
simplified
reverted
approved
rejected
}
-14
View File
@@ -1,14 +0,0 @@
#!/bin/bash
ports="5555,8000"
hosts="$(mktemp)"
echo -e "127.0.0.1\n10.0.0.166\n10.0.0.159" > "$hosts"
mkdir -p "$HOME/scans"
nmap_log="$HOME/scans/nmap_xml_log_`date +"%Y-%m-%d-%H%M-%Z"`.xml"
echo -e "\nLogging to $nmap_log\n"
nmap -T4 -Pn -p $ports -oX "$nmap_log" -iL "$hosts" \
|| rm "$nmap_log" \
&& echo -e "\nnmap failed! deleting $nmap_log\n"

Some files were not shown because too many files have changed in this diff Show More