Tomiwa-Ot / moukthar

Android remote administration tool
GNU General Public License v3.0
349 stars 94 forks source link

How to installing? and problems #20

Closed Forezsty closed 8 months ago

Forezsty commented 8 months ago

Hello, I tried to perform the installation as follows, but I was not successful. Ubuntu 22.04.3 LTS sudo apt install apache2 sudo git clone https://github.com/Tomiwa-Ot/moukthar.git sudo mv moukthar/Server/* /var/www/html/ cd /var/www/html/c2-server sudo apt install composer composer install sudo nano .env

DB_HOST='localhost'
DB_NAME='cc'
DB_USER='myuser'           *CHANGED
DB_PASSWORD='b!mbo4431312deCDAWAxlex'   *CHANGED
WS_SERVER='ws://localhost:8080'

cd /var/www/html/web\ socket/ composer install sudo nano .env

DB_HOST='localhost'
DB_NAME='cc'
DB_USER='myuser'           *CHANGED
DB_PASSWORD='b!mbo4431312deCDAWAxlex'  *CHANGED
WS_SERVER='ws://localhost:8080'

sudo apt-get install mysql-server sudo mysql -u root -p CREATE USER 'myuser'@'localhost' IDENTIFIED BY 'b!mbo4431312deCDAWAxlex'; GRANT ALL PRIVILEGES ON . TO 'myuser'@'localhost' WITH GRANT OPTION; FLUSH PRIVILEGES; EXIT; sudo mysql -u myuser -p create database cc; exit cd .. sudo mysql -u myuser -p cc < /var/www/html/database.sql sudo systemctl start apache2 sudo systemctl start mysql sudo systemctl status apache2

● apache2.service - The Apache HTTP Server
     Loaded: loaded (/lib/systemd/system/apache2.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2024-02-26 18:51:38 +03; 4s ago
       Docs: https://httpd.apache.org/docs/2.4/
    Process: 8027 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS)
   Main PID: 8031 (apache2)
      Tasks: 55 (limit: 9496)
     Memory: 21.2M
     CGroup: /system.slice/apache2.service
             ├─8031 /usr/sbin/apache2 -k start
             ├─8032 /usr/sbin/apache2 -k start
             └─8033 /usr/sbin/apache2 -k start

Feb 26 18:51:38 DESKTOP-8VFMU1B systemd[1]: Starting The Apache HTTP Server...
Feb 26 18:51:38 DESKTOP-8VFMU1B systemd[1]: Started The Apache HTTP Server.

sudo systemctl status mysql

● mysql.service - MySQL Community Server
     Loaded: loaded (/lib/systemd/system/mysql.service; enabled; vendor preset: enabled)
     Active: active (running) since Mon 2024-02-26 18:29:42 +03; 22min ago
    Process: 7613 ExecStartPre=/usr/share/mysql/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
   Main PID: 7621 (mysqld)
     Status: "Server is operational"
      Tasks: 41 (limit: 9496)
     Memory: 411.7M
     CGroup: /system.slice/mysql.service
             └─7621 /usr/sbin/mysqld

Feb 26 18:29:42 DESKTOP-8VFMU1B systemd[1]: Starting MySQL Community Server...
Feb 26 18:29:42 DESKTOP-8VFMU1B systemd[1]: Started MySQL Community Server.

php web\ socket/App.php

Error:
PHP Fatal error:  Uncaught PDOException: could not find driver in /var/www/html/web socket/src/Database.php:20
Stack trace:
#0 /var/www/html/web socket/src/Database.php(20): PDO->__construct()
#1 /var/www/html/web socket/App.php(14): C2\Database->__construct()
#2 {main}
  thrown in /var/www/html/web socket/src/Database.php on line 20

sudo apt-get install php-mysql php web\ socket/App.php

Log:
PHP Fatal error:  Uncaught RuntimeException: Failed to listen on "tcp://0.0.0.0:8080": Address already in use (EADDRINUSE) in /var/www/html/web socket/vendor/react/socket/src/TcpServer.php:184
Stack trace:
#0 /var/www/html/web socket/vendor/react/socket/src/Server.php(77): React\Socket\TcpServer->__construct()
#1 /var/www/html/web socket/vendor/cboden/ratchet/src/Ratchet/Server/IoServer.php(59): React\Socket\Server->__construct()
#2 /var/www/html/web socket/App.php(22): Ratchet\Server\IoServer::factory()
#3 {main}
  thrown in /var/www/html/web socket/vendor/react/socket/src/TcpServer.php on line 184

Maybe its work. sudo nano /etc/apache2/apache2.conf

I ADDED:
<Directory /var/www/html/c2-server>
      Options -Indexes
      DirectoryIndex app.php
      AllowOverride All
      Require all granted
</Directory>

sudo service apache2 restart Now i go to my panel but have this error

http://172.24.253.12/c2-server/  
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.

Please contact the server administrator at webmaster@localhost to inform them of the time this error occurred, and the actions you performed just before this error.

More information about this error may be available in the server error log.

tail -f /var/log/apache2/error.log

Log:
[Mon Feb 26 19:11:23.240760 2024] [core:alert] [pid 9234:tid 139799440651840] [client 172.24.240.1:64634] /var/www/html/c2-server/.htaccess: Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration

sudo a2enmod rewrite sudo systemctl restart apache2 Now error gone but when i enter the panel i only face php codes sudo apt install libapache2-mod-php sudo systemctl restart apache2 Now there is a php page but its sources are not loaded

Log:
fontawesome.min.css:1 
Failed to load resource: the server responded with a status of 404 (Not Found)
brands.min.css:1 
master.css:1 
bootstrap.min.css:1 
flag-icon.min.css:1 
jquery.min.js:1 
bootstrap.bundle.min.js:1 
datatables.min.js:1 
datatables.min.css:1   
c2-server/:1 
fontawesome.min.css:1
solid.min.css:1
brands.min.css:1
master.css:1
bootstrap.min.css:1
flag-icon.min.css:1
datatables.min.css:1 

cd c2-server/src/View nano header.php && nano footer.php

    OLD
<link href="/src/View/assets/..........css" rel="stylesheet">
    CHANGED
<link href="src/View/assets/..........css" rel="stylesheet">
    remove "/" on src
    Apply to all

Now i have only this errors

GET http://172.24.253.12/c2-server/ 404 (Not Found) c2-server/:1 
POST https://translate.googleapis.com/element/log?format=json&hasfast=true&authuser=0 net::ERR_BLOCKED_BY_CLIENT

php web\ socket/App.php

Web sockets started...

Now I opened the browser and went to my panel http://172.24.253.12/c2-server/. I am directly on the header.php page without login.php. Why am I not on the login screen and why only header.php appears. When I examined the point where I am, I realized that the header.php and footer.php page works, but the home.php page cannot work within this page. Look also when I press the "logout" button it throws me to http://172.24.253.12/logout

Not Found
The requested URL was not found on this server.

the same thing happens with the "reset password" button. there seems to be a lot of errors, is there something I'm missing? maybe I didn't install some dependencies? or do we have to edit the code ourselves? sudo cat /var/log/apache2/error.log when I run this code I don't see any current errors. Can you make a video of how it was installed?

Tomiwa-Ot commented 8 months ago

Go to http://172.24.253.12/ not http://172.24.253.12/c2-server/

Forezsty commented 8 months ago

hi this time I am doing the installation on my debian 12 server, I am trying to enter without putting the extension "c2-server" as you said. in the first image I made database.sql compatible with mariadb "utf8mb4_0900_ai_ci to utf8mb4_unicode_ci"

apt-get install php-mysql
apt install libapache2-mod-php
a2enmod rewrite
cd /var/www/html/c2-server && composer install && .env configured
cd /var/www/html/web\ socket/ && composer install && .env configured
Modify /etc/apache2/apache2.conf
php Server/web\ socket/App.php

I executed the commands above. When I log in to the url, I get the apache page. image 1 In the 2nd image, I removed the index.html page, but this time I only see the directory indexes image 2 I have attached my apache.conf file to the topic. What am I doing wrong, what is missing? Is there any other information you want me to send you? apache2.conf.txt

Tomiwa-Ot commented 8 months ago

Try commenting this part

<Directory /var/www/> Options Indexes FollowSymLinks AllowOverride None Require all granted

Forezsty commented 8 months ago
<Directory />
        Options FollowSymLinks
        AllowOverride None
        Require all denied
</Directory>

<Directory /usr/share>
        AllowOverride None
        Require all granted
</Directory>

#<Directory /var/www/>
    #    Options Indexes FollowSymLinks
    #    AllowOverride None
    #Require all granted
#</Directory>

<Directory /var/www/html/c2-server>
    Options -Indexes
    DirectoryIndex app.php
    AllowOverride All
    Require all granted
</Directory>

im going to my url http://+++.105.5.163/

Forbidden
You don't have permission to access this resource.

Apache/2.4.57 (Debian) Server at 194.105.5.163 Port 80

ERROR LOG [Fri Mar 01 22:13:52.700985 2024] [authz_core:error] [pid 11494] [client 212.8.250.240:10624] AH01630: client denied by server configuration: /var/www/html/ Permissions for "c2-server" rwxr-xr-x Octal mode 755 root@debian12:~# apachectl configtest Syntax OK

Tomiwa-Ot commented 8 months ago

Which user owns the files in /var/www? Trying changing it to www-data

chown -R www-data:www-data /var/www
Forezsty commented 8 months ago

root@debian12:/var/www/html# ls -l /var/www/html/c2-server

total 32
-rw-r--r-- 1 root root  1713 Mar  1 20:18 app.php
-rw-r--r-- 1 root root   217 Mar  1 20:18 composer.json
-rw-r--r-- 1 root root 11620 Mar  1 20:18 composer.lock
-rw-r--r-- 1 root root   420 Mar  1 20:18 routes.php
drwxr-xr-x 6 root root  4096 Mar  1 20:18 src
drwxr-xr-x 6 root root  4096 Mar  1 20:20 vendor

root@debian12:/var/www/html# chown -R www-data:www-data /var/www/html/c2-server root@debian12:/var/www/html# ls -l /var/www/html/c2-server

total 32
-rw-r--r-- 1 www-data www-data  1713 Mar  1 20:18 app.php
-rw-r--r-- 1 www-data www-data   217 Mar  1 20:18 composer.json
-rw-r--r-- 1 www-data www-data 11620 Mar  1 20:18 composer.lock
-rw-r--r-- 1 www-data www-data   420 Mar  1 20:18 routes.php
drwxr-xr-x 6 www-data www-data  4096 Mar  1 20:18 src
drwxr-xr-x 6 www-data www-data  4096 Mar  1 20:20 vendor

root@debian12:/var/www/html# sudo service apache2 restart

[Fri Mar 01 22:53:05.214982 2024] [authz_core:error] [pid 11827] [client 212.8.250.240:24331] AH01630: client denied by server configuration: /var/www/html/

403 Forbidden
You don't have permission to access this resource.

buddy if you want I can give you the server information so you can figure out faster what the problem is. I got the same errors on my ubuntu server. Telegram: https://t.me/sempronx

Tomiwa-Ot commented 8 months ago

https://linux.101hacks.com/unix/client-denied-by-server-configuration/

Tomiwa-Ot commented 8 months ago

It's me