User:E.zn/hackpact: Difference between revisions

From XPUB & Lens-Based wiki
No edit summary
No edit summary
 
(14 intermediate revisions by the same user not shown)
Line 1: Line 1:
<div style="float:right">
__TOC__
</div>
<br clear=all>
<div style="font-family:monospace; font-size:14px; background-color:#071918; color:white; padding:10px">
<div style="font-family:monospace; font-size:14px; background-color:#071918; color:white; padding:10px">
 
====-====






:- 1 -------------------------------------------------------------------------------------------
:- 1 -------------------------------------------------------------------------------------------
<div style="width:40%; float:left;>
<div style="width:40%; float:left;">
:- Running a web server on RPi at my place and hosting [http://leverburns.blue/ leverburns.blue]  
:- Running a web server on [[User:E.zn/rpi|RPi]] at my place and hosting [http://leverburns.blue/ leverburns.blue]  
:- Using Terminado to access the terminal on the server via browser [many thanks to Michael]
:- Using [https://github.com/jupyter/terminado Terminado] to access the terminal on the server via browser [many thanks to Michael]




Line 23: Line 27:
</div>
</div>
:::::::::::::::::::::::::::<pre style="background-color:#335035; border:none">lynx http://www.webleedlikeg.com/</pre>
:::::::::::::::::::::::::::<pre style="background-color:#335035; border:none">lynx http://www.webleedlikeg.com/</pre>
<div style="width:45%; float:right;>
<div style="width:45%; float:right;">
[[File:ack_1.png|550px|right]]
[[File:ack_1.png|550px|right]]
[[File:ack_2.png|550px|right]]
[[File:ack_2.png|550px|right]]
Line 54: Line 58:




</div>
<div style="background-color:white;">






<pre style="background-color:#071914; color:blue; border-color:blue; width:75%>


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






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


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


</pre>
</div>




<div style="font-family:monospace; font-size:14px; background-color:black; color:white; padding:10px">
====-====


</div>
<div style="font-family:monospace; font-size:14px; background-color:black; color:white; padding:10px">




:- 2 -------------------------------------------------------------------------------------------
:- 2 -------------------------------------------------------------------------------------------


 
<div style="width:55%; float:left;">
: Send lib.txt to 192.168.1.xxx over port 45788 using netcat
: Send lib.txt to 192.168.1.xxx over port 45788 using netcat
:::<pre style="background-color:#444861; border:none">nc 192.168.1.xxx 45788 < lib.txt</pre>
:::<pre style="background-color:#444861; border:none">nc 192.168.1.xxx 45788 < lib.txt</pre>
: Receive lib.txt over port 45788
: Receive lib.txt over port 45788
:::<pre style="background-color:#7D7E8B; border:none">nc -l 45788 > lib.txt</pre>
:::<pre style="background-color:#7D7E8B; border:none">nc -l 45788 > lib.txt</pre>
</div>
<br clear=all>


 
<div style="width:45%; float:right;">
<div style="width:45%; float:right;>
[[File:nc_3.png|550px|right]]
[[File:nc_3.png|550px|right]]
</div>
</div>
Line 96: Line 148:
:::<pre style="background-color:#7D7E8B; border:none">nc -l 33872</pre>
:::<pre style="background-color:#7D7E8B; border:none">nc -l 33872</pre>


</div>
<div>
<pre style="background-color:white; color:blue">
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
</pre>
</div>
<div style="font-family:monospace; font-size:14px; background-color:#071914; color:white; padding:10px">
====-====
:- 3 -------------------------------------------------------------------------------------------
:- Hosting an Etherpad instance on my RPi at [http://eth.leverburns.blue/ eth.leverburns.blue]
::- Resources
:::-- [https://serverfault.com/questions/538803/nginx-reverse-ssl-proxy-with-multiple-subdomains Reverse proxy w/multiple subdomains]
:::-- [https://webmasters.stackexchange.com/questions/60133/difference-between-cname-and-subdomain DNS records : Subdomain // A/CNAME ]
:::-- [https://github.com/nodesource/distributions Nodejs install]
:::-- [https://www.howtoforge.com/tutorial/ubuntu-etherpad-editor-server-installation/ Nodejs / MySQL / Etherpad]
:::-- [https://github.com/ether/etherpad-lite Git : Etherped-lite]
:::-- [https://networksofonesown.constantvzw.org/etherbox/manual.html#build-your-own-etherbox Networks Of Ones Own - Etherpad install]
<pre style="background-color:#071914; color:blue; border-color:blue; width:75%>
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
</pre>
: - nginx site configuration
<pre style="background-color:#071914; color:blue; border-color:blue; width:75%>
server {
      listen 80;
      server_name eth.leverburns.blue;
      location / {
          proxy_set_header X-Real-IP $remote_addr;
          proxy_pass http://localhost:9001/;
      }
}
</pre>
</div>


</div>
</div>

Latest revision as of 01:48, 8 March 2021


-

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