New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SQL is not Initiated #11

Open
pythonmaster41 opened this Issue Jun 13, 2017 · 39 comments

Comments

Projects
None yet
@pythonmaster41

pythonmaster41 commented Jun 13, 2017

Hi Audi,
I am trying to install this using git clone and when I try to initiate the DB Reset I am not getting anything. And apache logs are giving me below

::1 - - [13/Jun/2017:14:18:13 -0400] "GET /sqli-labs/sql-connections/setup-db.php HTTP/1.1" 500 848 "http://localhost/sqli-labs/" "Mozilla/5.0 (X11; Linux i686; rv:45.0) Gecko/20100101 Firefox/45.0"

I tried everything and seems not working. Any hints on solving this ? Thanks

@adithyanaresh

This comment has been minimized.

adithyanaresh commented Jun 14, 2017

Hey pythonmaster41,

I would recommend you to use the new generation installer, which is docker.
The link you may need is here : https://github.com/tuxotron/Audi_SQLi_lamp_container/tree/master/Audi_SQLi_lamp_container

@pythonmaster41

This comment has been minimized.

pythonmaster41 commented Jun 14, 2017

Thanks Adithya. i will try and let you know if that solved the issue

@mafiakid

This comment has been minimized.

mafiakid commented Jun 22, 2017

I have the same issue :(

@Rock718

This comment has been minimized.

Rock718 commented Nov 29, 2017

I found some extension were deprecated in PHP 5.5.0, example of "sql_connect()" ,and some were removed in PHP 7.0.0.Must I using it under PHP 5.5.0?

@vinayb173

This comment has been minimized.

vinayb173 commented Jun 4, 2018

screenshot from 2018-06-04 22-41-23

                                      Welcome    Dhakkan

SETTING UP THE DATABASE SCHEMA AND POPULATING DATA IN TABLES:

I can only see this thing on my screen , I am not able get them even i am not able to get the error too and i am using php5.6.36

@88iwantmore88

This comment has been minimized.

88iwantmore88 commented Jun 12, 2018

NEED HELP. Does anyone know what's wrong with this?

@88iwantmore88

This comment has been minimized.

88iwantmore88 commented Jun 12, 2018

SETTING UP THE DATABASE SCHEMA AND POPULATING DATA IN TABLES:

\n";} else {echo "[*]...................Error purging database: " . mysql_error(); echo "

\n";} //Creating new database security $sql="CREATE database security CHARACTER SET gbk "; if (mysql_query($sql)) {echo "[*]...................Creating New database 'SECURITY' successfully";echo "

\n";} else {echo "[*]...................Error creating database: " . mysql_error();echo "

\n";} //creating table users $sql="CREATE TABLE security.users (id int(3) NOT NULL AUTO_INCREMENT, username varchar(20) NOT NULL, password varchar(20) NOT NULL, PRIMARY KEY (id))"; if (mysql_query($sql)) {echo "[*]...................Creating New Table 'USERS' successfully";echo "

\n";} else {echo "[*]...................Error creating Table: " . mysql_error();echo "

\n";} //creating table emails $sql="CREATE TABLE security.emails ( id int(3)NOT NULL AUTO_INCREMENT, email_id varchar(30) NOT NULL, PRIMARY KEY (id) )"; if (mysql_query($sql)) {echo "[*]...................Creating New Table 'EMAILS' successfully"; echo "

\n";} else {echo "[*]...................Error creating Table: " . mysql_error();echo "

\n";} //creating table uagents $sql="CREATE TABLE security.uagents ( id int(3)NOT NULL AUTO_INCREMENT, uagent varchar(256) NOT NULL, ip_address varchar(35) NOT NULL, username varchar(20) NOT NULL, PRIMARY KEY (id) )"; if (mysql_query($sql)) {echo "[*]...................Creating New Table 'UAGENTS' successfully";echo "

\n";} else {echo "[*]...................Error creating Table: " . mysql_error();echo "

\n";} //creating table referers $sql="CREATE TABLE security.referers ( id int(3)NOT NULL AUTO_INCREMENT, referer varchar(256) NOT NULL, ip_address varchar(35) NOT NULL, PRIMARY KEY (id) )"; if (mysql_query($sql)) {echo "[*]...................Creating New Table 'REFERERS' successfully";echo "

\n";} else {echo "[*]...................Error creating Table: " . mysql_error();echo "

\n";} //inserting data $sql="INSERT INTO security.users (id, username, password) VALUES ('1', 'Dumb', 'Dumb'), ('2', 'Angelina', 'I-kill-you'), ('3', 'Dummy', 'p@ssword'), ('4', 'secure', 'crappy'), ('5', 'stupid', 'stupidity'), ('6', 'superman', 'genious'), ('7', 'batman', 'mob!le'), ('8', 'admin', 'admin'), ('9', 'admin1', 'admin1'), ('10', 'admin2', 'admin2'), ('11', 'admin3', 'admin3'), ('12', 'dhakkan', 'dumbo'), ('14', 'admin4', 'admin4')"; if (mysql_query($sql)) {echo "[*]...................Inserted data correctly into table 'USERS'";echo "

@PrashanthBanapur

This comment has been minimized.

PrashanthBanapur commented Jul 5, 2018

Hi Audi team ,

After setting up project ,Clicik on "Setup/reset Database for labs" I am getting below error

Fatal error: Uncaught Error: Call to undefined function mysql_connect() in /var/www/html/sqli-labs-master/sql-connections/setup-db.php:29 Stack trace: #0 {main} thrown in /var/www/html/sqli-labs-master/sql-connections/setup-db.php on line 29

my php version
root@kali:/# php --version
PHP 7.0.22-3 (cli) (built: Aug 23 2017 05:51:41) ( NTS )
Copyright (c) 1997-2017 The PHP Group

@M3chD09

This comment has been minimized.

M3chD09 commented Jul 20, 2018

Hi,

MySQL functions were removed in PHP 7, but we can use MySQLi functions instead.
If you have issues when installing this on PHP 7, try using my repository.

@Cukuyo

This comment has been minimized.

Cukuyo commented Sep 26, 2018

Hi,
One hour later , I see this issue : (

@Cukuyo

This comment has been minimized.

Cukuyo commented Sep 26, 2018

@M3chD09
Hi M3chD09 ,
I cloned your sqli-libs , but it's still error . I feel my hair is getting thinner again : (
Ubuntu 18.04 && PHP 7.2

@M3chD09

This comment has been minimized.

M3chD09 commented Sep 26, 2018

@M3chD09
Hi M3chD09 ,
I cloned your sqli-libs , but it's still error . I feel my hair is getting thinner again : (
Ubuntu 18.04 && PHP 7.2

Hi Cukuyo ,
Could you tell me more detailed information? For example, the commands you used and the errors you got when installing this.

@Cukuyo

This comment has been minimized.

Cukuyo commented Sep 26, 2018

@M3chD09
Hi M3chD09 ,
I cloned your sqli-libs , but it's still error . I feel my hair is getting thinner again : (
Ubuntu 18.04 && PHP 7.2

Hi Cukuyo ,
Could you tell me more detailed information? For example, the commands you used and the errors you got when installing this.

OK , M3chD09 .
I used about these .

  1. sudo apt install mysql-server , sudo apt install apache
  2. enter mysql and use 'UPDATE mysql.user SET authentication_string=PASSWORD('root'), PLUGIN='mysql_native_password' WHERE USER='root';'
  3. sudo apt install php //default to install php7
  4. sudo vim db-creds.inc //change password
  5. last , I used browser access the sql-labs folder to load index.html , and clicked

qq 20180926190013

@M3chD09

This comment has been minimized.

M3chD09 commented Sep 26, 2018

@M3chD09
Hi M3chD09 ,
I cloned your sqli-libs , but it's still error . I feel my hair is getting thinner again : (
Ubuntu 18.04 && PHP 7.2

Hi Cukuyo ,
Could you tell me more detailed information? For example, the commands you used and the errors you got when installing this.

OK , M3chD09 .
I used about these .

  1. sudo apt install mysql-server , sudo apt install apache
  2. enter mysql and use 'UPDATE mysql.user SET authentication_string=PASSWORD('root'), PLUGIN='mysql_native_password' WHERE USER='root';'
  3. sudo apt install php //default to install php7
  4. sudo vim db-creds.inc //change password
  5. last , I used browser access the sql-labs folder to load index.html , and clicked

qq 20180926190013

Hi Cukuyo ,
My repository has two branches, making sure you have cloned branch php7.
Also, make sure php-mysql is installed.
git clone -b php7 https://github.com/M3chD09/sqli-labs
sudo apt install php-mysql

@Cukuyo

This comment has been minimized.

Cukuyo commented Sep 27, 2018

@M3chD09
Right!M3chD09 , I solved it .
After I used git clone -b php7 and sudo apt install php-mysql , it still can't work . I looked at it , I guess the php code wasn't executed .
I used about these commands to make it work .
sudo apt-get install php7.2-gd php7.2-mbstring php7.2-xml
sudo apt install libapache2-mod-php
sudo apt-get install composer
sudo apt-get install apache2-dev
sudo apt-get install php7.2-dev
Luckly , it worked . But telled me can't connect the database security . I checked the set-up.php .
$con = new mysqli($host,$dbuser,$dbpass,$dbname);
In the set-up.php , It connects the security database first , and then deletes it and creates it .
I think this is a wrong logic .
The solution is to create an empty database called security .

@Torreira

This comment has been minimized.

Torreira commented Sep 27, 2018

Hello guys, i'm kinda new to this sort of stuff. I've recently installed the lab as per the instructed steps. Currently, i'm facing the issue of 'not getting the localhost/sqli-labs loaded up on my browser'.
Also, @M3chD09 and @Cukuyo , i utilised your repos and commands but still no relief from the issue. I'm banking on you guys to help me resort this issue.

ISSUE :

Not Found

The requested URL /sqli-labs was not found on this server.
Apache/2.4.27 (Debian) Server at localhost Port 80

sqli-labs-error screen

@Cukuyo

This comment has been minimized.

Cukuyo commented Sep 27, 2018

@Torreira
Hi , Torreira .
Make sure you put it in the right place . You should put it in this path '/var/www/html/' , this path is the default path of Apache2 .
Another , @M3chD09 , although I run it successly , it didn't give error info when I input error id parameter , like less-1 and less-2 .

@Torreira

This comment has been minimized.

Torreira commented Sep 27, 2018

@Cukuyo
Hi Cukuyo,
Thanks for the input. I did get the webpage but i'm confronted with a new 'Error message ' on the 'Database Part'. Regarding the 'db-creds.inc', am i supposed to input my login credentials of my kali or do i need to provide the login credentials for MySQL( i have'nt set up an account for MySQL on Kali machine before as i didn't use Mysql before on this machine).
sqli-labs-database-error

@halfluke

This comment has been minimized.

halfluke commented Sep 27, 2018

@Torreira
Hi , Torreira .
Make sure you put it in the right place . You should put it in this path '/var/www/html/' , this path is the default path of Apache2 .
Another , @M3chD09 , although I run it successly , it didn't give error info when I input error id parameter , like less-1 and less-2 .

same issue here: no errors such as "your sql syntax has an error... etc"

@Cukuyo

This comment has been minimized.

Cukuyo commented Sep 28, 2018

@Torreira
Hi , Torreira .
There is a sqli-labs database configuration file called db-creds.inc under foldersqli-labs/sql-connections/ . You are supposed to change the default username and password .
@halfluke
Hi , halfluke .
I think I find found the root of the problem .

qq 20180928101002
At first I thought it was the problem of PHP , but maybe this question comes from mysql .

@Torreira

This comment has been minimized.

Torreira commented Sep 28, 2018

@Cukuyo
Hi Cukuyo, yes i'm aware of the 'Db-creds.inc' file present inside sql-connections and do i need to change it( default ones) to my Kali machine's ( username and password ) or the 'MySql's username and password?

@Cukuyo

This comment has been minimized.

Cukuyo commented Sep 28, 2018

@Cukuyo
Hi Cukuyo, yes i'm aware of the 'Db-creds.inc' file present inside sql-connections and do i need to change it( default ones) to my Kali machine's ( username and password ) or the 'MySql's username and password?

Mysql ones . Must also be an account with administrator privileges (just use root one) , for creating database .

@halfluke

This comment has been minimized.

halfluke commented Sep 28, 2018

@Cukuyo
Hi Cukuyo, yes i'm aware of the 'Db-creds.inc' file present inside sql-connections and do i need to change it( default ones) to my Kali machine's ( username and password ) or the 'MySql's username and password?

Give a password to your mysql installation, I think it may not work with a blank password, then set the same user and password in db-creds.inc

@halfluke

This comment has been minimized.

halfluke commented Sep 28, 2018

@Torreira
Hi , Torreira .
There is a sqli-labs database configuration file called db-creds.inc under foldersqli-labs/sql-connections/ . You are supposed to change the default username and password .
@halfluke
Hi , halfluke .
I think I find found the root of the problem .

qq 20180928101002
At first I thought it was the problem of PHP , but maybe this question comes from mysql .

not sure of the difference but I have no time to check.
I found this one that works fine:
https://github.com/Rinkish/Sqli_Edited_Version

@Torreira

This comment has been minimized.

Torreira commented Sep 28, 2018

@Cukuyo @halfluke Umm. I haven't used the 'Mysql' DB in my kali machine before. Could you provide me the steps to change and set the credentials. That would really make my day.

@Cukuyo

This comment has been minimized.

Cukuyo commented Sep 28, 2018

@halfluke
Hi , halfluke .
That works fine !
@Torreira
Hi , Torreira , use this repo git clone https://github.com/Rinkish/Sqli_Edited_Version.git .
And following commands are my mysql installation with Ubuntu 18 .
sudo apt install mysql-server
sudo apt install php7.2-mysql
mysql -uroot -p //enter mysql
UPDATE mysql.user SET authentication_string=PASSWORD('root'), PLUGIN='mysql_native_password' WHERE USER='root'; //change password to 'root'

@Torreira

This comment has been minimized.

Torreira commented Sep 28, 2018

@Cukuyo I have cloned the above repo now. But, was'nt quite successful with the 'installation of mysql-server'.Also, should i use this(apt-get install mariadb-server) as an alternative to mysql ?Here's the error screen that i'm getting.
mysql-installation -error

@halfluke

This comment has been minimized.

halfluke commented Sep 28, 2018

@Cukuyo I have cloned the above repo now. But, was'nt quite successful with the 'installation of mysql-server'.Also, should i use this(apt-get install mariadb-server) as an alternative to mysql ?Here's the error screen that i'm getting.
mysql-installation -error

yes, mariadb-server should be the one
You can still start it with: service mysql start
Double check the way to change the root password

@Torreira

This comment has been minimized.

Torreira commented Sep 28, 2018

@halfluke @Cukuyo Am i doing this as intended or have i got it all wrong?
mysql-installation -error

@Torreira

This comment has been minimized.

Torreira commented Sep 28, 2018

@Cukuyo @halfluke That wasn't the above image.Yikes. Sorry my bad.
mysql-updation

@halfluke

This comment has been minimized.

halfluke commented Sep 28, 2018

@Cukuyo @halfluke That wasn't the above image.Yikes. Sorry my bad.
mysql-updation

should be good, exit and log back into mysql using password root.
Then configure dbcreds-inc and see if you can set up the db for sqli labs
Of course you have to place the sqlilabs folder under /var/www/html and start apache as well

image

@Torreira

This comment has been minimized.

Torreira commented Sep 28, 2018

@halfluke Was able to login successfully. Thank you. But, i'm unable to set-up the DB.
database-setup

@halfluke

This comment has been minimized.

halfluke commented Sep 28, 2018

@halfluke Was able to login successfully. Thank you. But, i'm unable to set-up the DB.
database-setup

Post your db-creds.inc configuration

@Torreira

This comment has been minimized.

Torreira commented Sep 28, 2018

@halfluke

This comment has been minimized.

halfluke commented Sep 28, 2018

so now you have an issue that I think I had in the past and I can't remember how I solved it.
Something like this: dbeaver/dbeaver#3524
So are you saying that you can connect to mariadb from a terminal with: mysql -u root -p
and then entering password 'root' ?
If you can - directly as root@kali without sudo, but the connection from db-creds.inc / sqlilabs doesn't work, you have to research about this.
Perhaps you can start by setting the mariadb root password the same as your kali root password

@Torreira

This comment has been minimized.

Torreira commented Sep 28, 2018

@halfluke
1.So are you saying that you can connect to mariadb with mysql -u root -p
and then entering password 'root' ? (YES)
2.Perhapas you can start by setting the mariadb root password the same as your kali root password (WILL TRY WITH THIS!Thanks)

@Torreira

This comment has been minimized.

Torreira commented Sep 28, 2018

@halfluke @Cukuyo Finally, i've got it up and running. I did install "XAMPP". Now, i'm getting an error of this sort.
finally-look that
new error

@Torreira

This comment has been minimized.

Torreira commented Sep 28, 2018

@halfluke I'm able to see the Databases via terminal but currently unable to play around with the excercises/tasks.
mysql-database

@halfluke

This comment has been minimized.

halfluke commented Sep 28, 2018

Come on mate, it's /?id=1, not /id=1

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment