Wednesday, February 7, 2018

Send sms using dongle by python code

In windows,

install python-gammu (pip3 install python-gammu)
plug your dongel and install it throught its software
go to device manger and click on Ports(COM & LPT)
under that menu you will see your dongel and remind the com port
install wammu
connect the dongel
get wammu > settings > connection tab and click on add button
next click guided configuration, click on usb cable radio button and Next
select i dont know radio button and click next
select AT based and next
keep driver to use as Generic...
and click next
in the drop down menu select the certain com port and click next.
it will sync with device.
click ok
in wammu click phone > and click on connect.
if its connect all is well.
then take run and type %appdata%
go down and open the .gammurc file and copy the content to the notepad and save it on a accessible location.

Integrate, bind with Active Directory using python

first install python-ldap

#Using this code can get the user list
"""""""""""""""""""""""""""""""""""""""

import ldap
from ldap.controls import SimplePagedResultsControl
import sys
import ldap.modlist as modlist

LDAP_SERVER = "ldaps://dc.host.com"
BIND_DN = "Operator@host.com"
BIND_PASS = "password"
USER_FILTER = "(&(objectClass=person)(primaryGroupID=7235))"
USER_BASE = "ou=Special Peeps,ou=My Users,dc=host,dc=com"
PAGE_SIZE = 10

# LDAP connection
try:
  ldap.set_option(ldap.OPT_X_TLS_REQUIRE_CERT, 0)
  ldap_connection = ldap.initialize(LDAP_SERVER)
  ldap_connection.simple_bind_s(BIND_DN, BIND_PASS)
except ldap.LDAPError, e:
  sys.stderr.write('Error connecting to LDAP server: ' + str(e) + '\n')
  sys.exit(1)

Image captcha recognizing and extract string for captcha bypass

Install pytesseract and images,
sudo pip install pytesseract
sudo pip install pillow

Install Google Tesseract OCR in the machine. In Linux,
apt-get install tesseract-ocr

type in the terminal 'tesseract' and see whether its working.

Then the following is the code for captcha recognize.

Code :

from PIL import Image
import pytesseract

print pytesseract.image_to_string(Image.open('/home/ubuntu/Desktop/index.jpeg'))


Instead of the indicated path put the captcha image path.

Source:
https://pypi.python.org/pypi/pytesseract