User:E.zn/hackpact

From XPUB & Lens-Based wiki
< User:E.zn
Revision as of 02:00, 12 November 2020 by E.zn (talk | contribs)


-

- 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





















-

- 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 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

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
----------------------------------------------------------------

root@kibkadar:~/etherpad-lite# 

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 'ethpss';
««««««««««««««««««««««««««««««««««««««««««««««

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
««««««««««««««««««««««««««««««««««««««««««««««

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/;
      }
 }