Black Hat Python

Black Hat PythonJęzyk Python dla hakerów i pentesterów Author: Justin Seitz amazon.plempik.comhelion.pl

2017-05-22 · 1 min · timor

pip - uninstall package with dependencies

Virtualenvs in python are cheap but from time to time you will install something with pip on your system and when time comes removing all this crap could be difficult. I found this bash snippet that will uninstall package with all dependencies: for dep in $(pip show python-neutronclient | grep Requires | sed 's/Requires: //g; s/,//g') ; do sudo pip uninstall -y $dep ; done pip uninstall -y python-neutronclient Source: http://stackoverflow....

2016-04-26 · 1 min · timor

Extract password saved in remmina

I had some passwords saved in remmina but like it always happen, I wasn’t been able to remember them when needed. Trying to restore them I found that they’re encrypted in .remmina directory. Then I used this script to the decrypt them 1: Extract script import base64 from Crypto.Cipher import DES3 secret = base64.decodestring("<STRING FROM remmina.prefs>") password = base64.decodestring("<STRING FROM XXXXXXX.remmina>") print DES3.new(secret[:24], DES3.MODE_CBC, secret[24:]).decrypt(password) http://askubuntu.com/questions/290824/how-to-extract-saved-password-from-remmina  external link  ↩︎

2015-12-25 · 1 min · timor

Quickly setup SQL query logging on console in Django

There is need plugin for Django, named django-debug-toolbar but it needs some time to configure. So when I need simple way to debug SQL queries I use small hack. Add to your settings.py: LOGGING = { 'version': 1, 'disable_existing_loggers': False, 'handlers': { 'console': { 'level': 'DEBUG', 'class': 'logging.StreamHandler', } }, 'loggers': { 'django.db.backends': { 'handlers': ['console'], 'level': 'DEBUG', }, } } To get this working DEBUG option have to be set to True:...

2014-05-28 · 1 min · timor

Instalacja Python’a na Windowsie

Pomimo że Python dużo częściej wykorzystywany jest w środowiskach UNIX’owcy/Linux’owych to znajdzie się kilka fajnych zastosowań dla tego języka na Windowsie. Możliwości na instalację jest kilka, a najprostsza to wykorzystanie instalatora ActiveState. Wersja ta ma w sobie wszystko co potrzebne: rozszerzenia dla API Windows menadżera pakietów PyPM dokumentację Niestety jakiś czas temu zmieniły się zasady licencjonowania w ActiveState i aktualne wersje dla zastosowań produkcyjnych wymagają zakupu licencji (1000$/rok - aż chce się zacytować z Dnia Świra: czizys k…wa…)....

2013-09-25 · 2 min · timor

Sprawdzanie zainstalowanej wersji Django

Ten one liner załatwia sprawę: python -c 'import django; print ".".join([str(s) for s in django.VERSION]);'

2013-09-16 · 1 min · timor

Python - wysyłanie maili w unicode

Chciałem wysłać z Python’a maila z krzakami tab by ładnie się wyświetlały i okazało się to całkiem nietrywialne. Na szczęście googiel podpowiedział mi doskonałego gotowca, którego zamierzam zapisać by mi nie zginął: #!/usr/bin/env python # -*- coding: utf-8 -*- import smtplib from email.mime.text import MIMEText from email.Header import Header from email.Utils import parseaddr, formataddr def send_email(sender, recipient, subject, body): """Send an email. All arguments should be Unicode strings (plain ASCII works as well)....

2012-12-10 · 2 min · timor