Tag: mysql

Brute-force, Databases, Metasploit, MySQL

Brute forcing MySQL

There is an auxiliary module in Metasploit called mysql_login which will happily query a MySQL server for specific usernames and passwords.   To start your attack you have to set the RHOSTS option and choose a username and a password if you would like a single login query. SET RHOSTS 192.168.2.13SET RHOSTS 192.168.2.13 Let’s try …

Metasploit, NMAP, Port Scanning

Discover open mysql ports

MySQL is running by default on port 3306. To discover MySQL you can do it either with nmap or with Metasploit’s auxiliary modules.   The NMAP way Nmap is a free and open source network discovery and security auditing utility. It can discover open ports, running services, operating system version and much more. To discover …

MySQL, Python

Connect to a MySQL database in Python

import MySQLdb as mysqlib import sys   dbserver = "localhost" dbuser = "username" dbpass = "********" db = "dbname" conn = None   try: conn = mysqlib.connect(dbserver, dbuser, dbpass, db); print "Connected!n"   cursor = conn.cursor() cursor.execute("SELECT * from datatable")   results = cursor.fetchall()   for record in results: print record[0] , ", ", record[1] …

Drupal, MySQL

Reset Drupal’s theme using MySQL

If you have broken everything by renaming, editing or removing the default theme and you have trouble signing in to administration panel then in this case you can fix the problem by changing Drupal’s default theme in MySQL database. Open PHPMyAdmin or MySQL Workbench and execute the following sql queries. Set Garland theme as default: …

PHP

How To Write A Simple PHP Web Service

Web Services are Everywhere! Let’s see how easy it is to create one using PHP, MySQL and XML! First of all create a mysql database named notes. Add a table named notes too: CREATE TABLE IF NOT EXISTS `notes` ( `ID` INT(10) UNSIGNED NOT NULL AUTO_INCREMENT, `Title` VARCHAR(50) COLLATE utf8_unicode_ci NOT NULL, `Note` VARCHAR(500) COLLATE …

Cross-Platform, Java

Using mysql with Java

First of all download the Connector/J. Don’t forget to add in your project a reference to mysql-connector-java-x.x.x-bin.jar file. Let’s see the code: 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 import java.sql.Statement; import java.sql.Connection; import java.sql.DriverManager; import java.sql.ResultSet; import java.sql.SQLException; …