Skip to content

Instantly share code, notes, and snippets.

View smartm13's full-sized avatar
Hopping!

Mihir Parikh smartm13

Hopping!
View GitHub Profile
@smartm13
smartm13 / gsheet.py
Created May 16, 2017 22:43
Googly Sheets Python API in usable format
from __future__ import print_function
import httplib2
import os
from apiclient import discovery
from oauth2client import client
from oauth2client import tools
from oauth2client.file import Storage
SCOPES = 'https://www.googleapis.com/auth/spreadsheets'
@smartm13
smartm13 / broRanker.py
Created May 16, 2017 22:46
A serp script to find out rank of keyword for particular website..... beauty is final callable
def getval(s,f,t):
st=s.find(f)+len(f)
return s[st:s.find(t,st)]
def dsp(zrc):
pass#with open("C:\Users/smartm13/Desktop/op.txt.html",'w') as f:f.write(zrc)
proxies=[]
def hidemyass(config='1649468'):# and ('1870962' or '1870954')):
import requests
rg=requests.get
@smartm13
smartm13 / flask_app.py
Created May 31, 2017 06:06
BSNL OTP Spammer
from flask import Flask,request,Response
import requests,json
app = Flask(__name__)
app.config['DEBUG'] = True
@app.errorhandler(404)
def page_not_found(e):
"""Return a custom 404 error."""
@smartm13
smartm13 / flask_app.py
Created May 31, 2017 06:15
GCM Web push notification
# Copyright 2015 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
@smartm13
smartm13 / PvProDailyCoins.py
Last active January 16, 2019 08:20
for csgo steam gamers: hits the claim coins button on pvpro
#pvpro credentials
username='carbonhorse'#put-pvpro-uname-here
password='<put-pvpro-password-here>'
import datetime
if datetime.datetime.now()!=10:exit()
import requests
getheaders= {
'Accept-Encoding': 'gzip, deflate, br',
##shebang python 2.7
#pvpro daily free coins claimer
from crontab import CronTab
from datetime import datetime
import time
#pvpro credentials of all users
credentails=[
#(username,password),
@smartm13
smartm13 / batchStringRepl.py
Last active December 5, 2018 07:34
Helper code to find replace string in directory recursively
malCfile="maliciousOnly.txt"
baseDir="back_up_dir/websites"
replCfile="disInfectedComment.txt"
workext="js,php"
import sys,os,time,json
if sys.version_info[0] < 3:
input=raw_input
print("Current Directory:")
print(os.path.abspath(os.getcwd()))
@smartm13
smartm13 / py2ipynb.py
Created January 23, 2019 10:21
A python module trying to convert jupyter exported .py files back to .ipynb
def py2ipy(fpy):
import nbformat
import re
from nbformat.v4 import new_notebook, new_code_cell
with open(fpy) as f:
src = f.read()
src = src.replace('# coding: utf-8', '')
cells = [new_code_cell(cell) for cell in re.split('\n\n\n# In\[[0-9]+\]:\n\n\n', src)]
@smartm13
smartm13 / burp2requests_module.py
Last active February 26, 2019 22:06
A python function to convert raw http request (mostly copied from burp or verbose curl) into a requests function.. Creates a dynamic function that can accept variables.
def burp2req(rawDump):
"""paste the raw dump from burp suite and replace all variables b/w << >>.
It will return an equivalent py function that accepts variables from dump and returns response obj"""
head=list(map(str.strip,rawDump.split("\n\n",1)))
if len(head)==2:head,body=head
else:head,body=head[0]," "
l1,head=head.split('\n',1)
l1,head=l1.split(),dict([map(str.strip,h.split(":",1)) for h in head.split('\n') if h.strip()])
host=head.get('Host',head.get('host',head.get("HOST",None)))
pr="https://" if l1[-1]=="HTTP/1.1" else "http://"
@smartm13
smartm13 / batchFindReplace.py
Last active March 15, 2019 17:35
Batch string find replace #untested
#batch find replace
basepath=input("Enter fullpath of project rootdir:")
findtext=input("Enter fullpath of find_to text file:")
reptext=input("Enter fullpath of replace_with text file:")
endswithfilter=input("Enter the string the target files should end with [.html for example]:")
#setting
progress=1000#report after every n no. of files.
encoding='latin-1'#encoding to read and write all files with