Tag Archives: http

PHP – Redirecting Malicious IP Address

0
Filed under php
Tagged as , , , , ,

Author: slac3dork
site: http://snippet.c0de.me
summary: PHP code to redirect user from malicious IP address

<?php 

/**
  _________      .__       .____   _______
 /   _____/ ____ |__|_____ |    |  \   _  \    ____
 \_____  \ /    \|  \____ \|    |  /  /_\  \  / ___\
 /        \   |  \  |  |_> >    |__\  \_/   \/ /_/  >
/_______  /___|  /__|   __/|_______ \_____  /\___  /
        \/     \/   |__|           \/     \//_____/  

http://snippet.c0de.me

slac3dork@gmail.com
*/

/* Replace this with your IP address.. */
$malicious_ip = '127.0.0.1'

if ($_SERVER['REMOTE_ADDR'] == $malicious_ip) {
header("Location: http://www.example.com/");
}
?>



php,logo,pixel badge,badge

Python – Get Total Subscriber From Feedburner

0
Filed under python
Tagged as , , , , , , , ,

Author: slac3dork
Site: http://snippet.c0de.me
Summary: Python script to get total subscriber from Feedburner. Before run this script, Feedburner awareness API must be activated. This is script is inspired by Eric Wendelin.
Usage: python filename.py

#!/usr/bin/python
#
#  _________      .__       .____   _______
# /   _____/ ____ |__|_____ |    |  \   _  \    ____
# \_____  \ /    \|  \____ \|    |  /  /_\  \  / ___\
# /        \   |  \  |  |_> >    |__\  \_/   \/ /_/  >
#/_______  /___|  /__|   __/|_______ \_____  /\___  /
#        \/     \/   |__|           \/     \//_____/
# http://snippet.c0de.me
# slac3dork[at]gmail[dot]com
#!/usr/bin/env python

# IMPORTANT: Feedburner awareness API must be activated

# Replace with your own name
feedburner_name = "c0deme"

import urllib
from xml.dom import minidom

try:
  dom = minidom.parse(urllib.urlopen('https://feedburner.google.com/api/awareness/1.0/GetFeedData?uri='+feedburner_name))
  entry = dom.getElementsByTagName('entry')[0]
  count = entry.getAttribute('circulation')
  print "total subscriber:",count
except:
  print "Oops! Something went wrong. Check your feedburner's name or your internet connection."



python,logo,banner

Ruby – Simple Web Server

0
Filed under ruby
Tagged as , , , , , , ,

Author: slac3dork
Site: http://snippet.c0de.me
Summary: Simple web server using Ruby’s standard library. Tested on Linux and Ruby 1.8.7.
Usage: ruby filename.rb

#!/usb/bin/ruby

#  _________      .__       .____   _______
# /   _____/ ____ |__|_____ |    |  \   _  \    ____
# \_____  \ /    \|  \____ \|    |  /  /_\  \  / ___\
# /        \   |  \  |  |_> >    |__\  \_/   \/ /_/  >
#/_______  /___|  /__|   __/|_______ \_____  /\___  /
#        \/     \/   |__|           \/     \//_____/
# http://snippet.c0de.me
# slac3dork[at]gmail[dot]com

require 'webrick'

# importing WEBrick module
include WEBrick

# Creating HTTPServer instance on port 2000
server = HTTPServer.new(
:Port => 2000,
:DocumentRoot => "/home/slac3dork/ruby/www/"
)

# To shutdown server if get an interrupt signal (ctrl-c).
trap("INT"){ server.shutdown }

# To run the server
server.start




ruby,code,code,snippet