ExifRead is the package to read pictures attribute from files.
1. Download the file ExifRead-2.1.2.tar.gz
2. >gunzip ExifRead-2.1.2.tar.gz
3. >tar -xvf ExifRead-2.1.2.tar
4. >cd ExifRead-2.1.2
5. >sudo python setup.py install
This blog is created to keep things which I always need to remember in Python and Linux scripting. ... and few other things.
Friday, February 24, 2017
Thursday, February 23, 2017
Using MySQLdb with Python
To be able to connect python scripting with MySqlDB install packages.
sudo apt-get install python-mysqldb
sudo apt-get install python-htmlgen
sudo apt-get install phpmyadmin
use in python script
import MySQLdb as mdb
import base64
SCRIPT = sys.argv[0].split("/")[-1:][0]
MYSQL_DATABASE_NAME='links'
MYSQL_USER='root'
MYSQL_PASSWORD=base64.b64decode('cm9vdDEyMw==')
MYSQL_PASSWORD='root123'
SQL_LIMIT = 500
database_name=MYSQL_DATABASE_NAME
con = mdb.connect('localhost',MYSQL_USER,MYSQL_PASSWORD,MYSQL_DATABASE_NAME)
cur = con.cursor()
sudo apt-get install python-mysqldb
sudo apt-get install python-htmlgen
sudo apt-get install phpmyadmin
use in python script
import MySQLdb as mdb
import base64
SCRIPT = sys.argv[0].split("/")[-1:][0]
MYSQL_DATABASE_NAME='links'
MYSQL_USER='root'
MYSQL_PASSWORD=base64.b64decode('cm9vdDEyMw==')
MYSQL_PASSWORD='root123'
SQL_LIMIT = 500
database_name=MYSQL_DATABASE_NAME
con = mdb.connect('localhost',MYSQL_USER,MYSQL_PASSWORD,MYSQL_DATABASE_NAME)
cur = con.cursor()
Run Python as CGI in Apache2
1. Install apache2
sudo apt-get install apache2
2. Install python
sudo apt-get install python
3. Enable CGI processing in apache2
sudo a2enmod cgi
4. Modify file /etc/apache2/sites-available/000-default.conf to include:
5. Restart apache2
sudo service apache2 restart
https://www.linux.com/blog/configuring-apache2-run-python-scripts
sudo apt-get install apache2
2. Install python
sudo apt-get install python
3. Enable CGI processing in apache2
sudo a2enmod cgi
4. Modify file /etc/apache2/sites-available/000-default.conf to include:
#ServerName www.example.com
ServerAdmin webmaster@localhost
DocumentRoot /var/www
<Directory />
Options FollowSymLinks
AllowOverride None
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
</Directory>
ScriptAlias /cgi-bin/ /var/www/cgi-bin/
<Directory "/var/www/cgi-bin">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
AddHandler cgi-script .py
AddHandler default-handler .html .htm
Allow from all
</Directory>
<Directory "/var/www/run">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
AddHandler cgi-script .py
AddHandler default-handler .html .htm
Allow from all
</Directory>
<Directory "/var/www/tracedecode">
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
AddHandler cgi-script .py
AddHandler default-handler .html .htm
Allow from all
</Directory>
# AddHandler mod_python .py
5. Restart apache2
sudo service apache2 restart
https://www.linux.com/blog/configuring-apache2-run-python-scripts
Allow remote SSHas root login
Become root
sudo su
Create password as root
passwd
Modify file /etc/ssh/sshd_config
# Authentication:
LoginGraceTime 120
# PermitRootLogin prohibit-password
PermitRootLogin yes
StrictModes yes
Restart SSH service
sudo su
Create password as root
passwd
Modify file /etc/ssh/sshd_config
# Authentication:
LoginGraceTime 120
# PermitRootLogin prohibit-password
PermitRootLogin yes
StrictModes yes
Restart SSH service
sudo service sshd restart
Wednesday, February 22, 2017
Subscribe to:
Posts (Atom)
Followers
About Me
- Krzysztof Pakuła
- Znak zodiaku - Lew