User:E.zn/hackpact

From XPUB & Lens-Based wiki
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.


-

- 1 -------------------------------------------------------------------------------------------
- Running a web server on RPi at my place and hosting leverburns.blue
- Using Terminado to access the terminal on the server via browser [many thanks to Michael]







Fail.gif
lynx http://www.webleedlikeg.com/
Ack 1.png
Ack 2.png

















====================================================================
////////////////////////////////////////////////////////////////////



sudo apt-get install python3-venv
sudo apt-get install python3
sudo apt-get install python3-pip
sudo apt-get install git

sudo nano requirements.mine.txt
»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
asn1crypto==0.24.0
cffi==1.14.4
configparser==3.5.0b2
cryptography==2.6.1
entrypoints==0.3
enum34==1.1.6
ipaddress==1.0.17
keyring==17.1.1
keyrings.alt==3.1.1
ptyprocess==0.7.0
pycairo==1.20.0
pycparser==2.20
pycrypto==2.6.1
PyGObject==3.30.4
pyxdg==0.25
RPi.GPIO==0.7.0
SecretStorage==2.3.1
six==1.12.0
-e git+https://github.com/jupyter/terminado.git@c0e14088dcd7bde85683a0bde6f141959ebb8cf7#egg=terminado
tornado==6.1
tornado-xstatic==0.2
XStatic==1.0.2
XStatic-term.js==0.0.7.0
««««««««««««««««««««««««««««««««««««««««««««««

cd terminado
sudo pip3 install -r requirements.mine.txt
sudo -H pip3 install virtualenv 
virtualenv -p python3.7 z
source z/bin/activate
pip install tornado 
pip install tornado_xstatic
pip install terminado
pip install xstatic
pip install XStatic-term.js
python demos/single.py

////////////////////////////////////////////////////////////////////
====================================================================


-

- 2 -------------------------------------------------------------------------------------------
Send lib.txt to 192.168.1.xxx over port 45788 using netcat
nc 192.168.1.xxx 45788 < lib.txt
Receive lib.txt over port 45788
nc -l 45788 > lib.txt


Nc 3.png



Send text over url
echo '///////////////////'  | nc leverburns.blue 33872
Receive the message on a web server over 33872
nc -l 33872




Fixing bricked SD card

-- microSD card [mmcblk0] had 2 partitions, both showing less than actual total capacity [only 2 gb out of 16]

>> lsblk
NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 223,6G  0 disk 
├─sda1        8:1    0 206,7G  0 part /
└─sda2        8:2    0  16,9G  0 part [SWAP]
mmcblk0     179:0    0  14,9G  0 disk                <<<<<<<
├─mmcblk0p1 179:1    0   100M  0 part /media/ezn/x   <<<<<<<
└─mmcblk0p2 179:2    0   1,9G  0 part /media/ezn/x1  <<<<<<<

-- Delete partitions

>> sudo fdisk /dev/mmcblk0
>> d
>> 1
>> d
>> q

-- Unmount both

-- Format 

>> sudo mkfs.ext4 /dev/mmcblk0


-

- 3 -------------------------------------------------------------------------------------------
- Hosting an Etherpad instance on my RPi at eth.leverburns.blue
- Resources
-- Reverse proxy w/multiple subdomains
-- DNS records : Subdomain // A/CNAME
-- Nodejs install
-- Nodejs / MySQL / Etherpad
-- Git : Etherped-lite
-- Networks Of Ones Own - Etherpad install



sudo -i

curl -sL https://deb.nodesource.com/setup_15.x | bash -

apt-get install -y nodejs

apt-get install -y build-essential

git clone --branch master https://github.com/ether/etherpad-lite.git && cd etherpad-lite && bin/run.sh

errors
----------------------------------------------------------------
npm ERR! code FETCH_ERROR
npm ERR! errno FETCH_ERROR
npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/libnpx (over 300000ms)

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2020-11-11T00_21_16_947Z-debug.log
----------------------------------------------------------------

apt install mysql-server mysql-client

apt-get install npm git

errors 
----------------------------------------------------------------
[...]
Depends: node-which (>= 1.3~) but it is not going to be installed
       Depends: node-wrappy (>= 1.0.2~) but it is not going to be installed
       Depends: node-write-file-atomic (>= 2.3~) but it is not going to be installed
E: Unable to correct problems, you have held broken packages.
----------------------------------------------------------------

apt update

apt install aptitude

cd /opt

sudo git clone https://github.com/ether/etherpad-lite.git

mv etherpad-lite etherpad

sudo adduser --system --no-create-home --home=/opt/etherpad --group etherpad

sudo chown -R etherpad:etherpad etherpad

cd etherpad

sudo --user etherpad cp settings.json.template settings.json

sudo --user etherpad nano settings.json

apt-get install mysql-server

errors 
----------------------------------------------------------------
This may mean that the package is missing, has been obsoleted, or
is only available from another source
However the following packages replace it:
  mariadb-server-10.0

E: Package 'mysql-server' has no installation candidate
----------------------------------------------------------------

sudo apt install mariadb-server-10.3 php-mysql

mysql
»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
create database etherpad;
grant all on etherpad.* to 'etherpaduser'@'localhost' identified by 'etherpadpass';
««««««««««««««««««««««««««««««««««««««««««««««

mysql -u etherpaduser -p etherpad

exit

sudo nano /etc/systemd/system/etherpad.service
»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
[Service]
Type=simple
User=etherpad
Group=etherpad
WorkingDirectory=/opt/etherpad
ExecStart=/usr/bin/nodejs /opt/etherpad/node_modules/ep_etherpad-lite/node/server.js
Restart=always

[Install]
WantedBy=multi-user.target
««««««««««««««««««««««««««««««««««««««««««««««

cd /opt/etherpad
sudo --user etherpad nano settings.json
»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»»
/*
"dbSettings" : {
                   "filename" : "var/dirty.db"
                 },
*/

"dbType" : "mysql",
   "dbSettings" : {
                    "user"    : "etherpaduser",
                    "host"    : "localhost",
                    "password": "etherpadpass",
                    "database": "etherpad",
                    "charset" : "utf8mb4"
                  },
««««««««««««««««««««««««««««««««««««««««««««««

sudo systemctl start etherpad
sudo systemctl status etherpad
- nginx site configuration

server {
      listen 80;
      server_name eth.leverburns.blue;

      location / {
          proxy_set_header X-Real-IP $remote_addr;
          proxy_pass http://localhost:9001/;
      }
 }