Skip to main content

Github Repositories Link Parser Using Bash

Hello Friends,

Welcome Again To My Blog. Today, I am going To Share With You Another Simple Bash Script That Can Parse All Repositories Links From Anyone Github Accounts Just in few Seconds. You don't need to do anything, Just Run this bash script, provide github username, Repositories types and Output filename to save all parse links. Well I'm hoping that You all are already aware of Github Repositories and Link Extracting Concept.

This Bash Script is really very to Understand and By The Way, For Completely New Bies, I had Used Good Comments Lines To Make Sure, that This Script look More Easy To Understand.

To Run This Script

chmod +x

Well In This Script, I Used Various Tool To Achieve my Goals like
wget  = To Download Html Page Data
tr    = To Replace String Character With Another One
grep  = To Grep Matching Lines
cut   = Split Strings
uniq  = To Remove Duplicate
sort  = To Sorting
xargs = Manipulate String
And Bash Syntaxs. 

if You don't know that much these tools, then, don't worry use linux man page. Just Type in Your Terminal

man name_of_tool

Github Repositories Links Parser Using Bash Script

# ==============================================================
#          Please, Don't Remove Author Details 
# ==============================================================
# Author : Suraj Singh Bisht
# Description:
#            This Script Can Extract All Available Repositories Links With Details From
#            Anyone Github Account.

# instruction to use script

# usages details
if [ $# = 1 ]; then
 if [ $1 = "--help" ] || [ $1 = "-h" ]; then
  printf "====================================================================\n";
  printf "\--------------------- This is Help Menu ---------------------------/\n";
  printf "====================================================================\n";
  printf "                                      Author: Suraj Singh \n";
  printf "                            \n\n";
  printf "\---------------------- Read Me -----------------------------------/\n";
  printf "       This program can extract Github repositries links of Any \n";
  printf "  Specific Account. If you want to find all repo links of anyone Github,\n";
         printf "  Just Run This parse over that Account. This script can extract links\n";
         printf "  and Can Save All Links into txt files.\n\n";
  printf "Simple Usages:\n";
  printf "\n\tProgram Usages : %s [url] [repo_type] [output]\n\n" $0;
  printf "Url :\n";
  printf "Repo : fork, source\n";
  printf "output : file_name_to_save Output\n";
  printf "\n\nExample\n"
  printf "  %s github_user_name source links.txt\n\n\n" $0;
 if [ $# != 3 ]; then
       printf "  %s --help\n" $0;
         printf "\nProgram Usages : %s [url] [repo_type] [output]\n\n" $0;


# initialize user inputs

# Time To Download First Page of Account

printf "\n\nGenerating Github link : %s\n" $w

wget $w -O /tmp/github_link_extractor

for((n=0; n<1; n++))

 cat /tmp/github_link_extractor | tr ' ' '\n' | tr '>' '\n' | grep -i "href=[^>]" | cut -d '"' -f 2 | uniq | sort | grep -e "/$USERNAME/.*" | xargs -n 1 -I% echo "" > $OUTPUT_F ;

 token=$(cat /tmp/github_link_extractor | tr " " "\n" |grep -e "href="| tr ">" "\n" | grep -e "after" | cut -d"=" -f3 | cut -d"&" -f 1);

for((n=0; n<1; n++))
 if [ ${#token} -le 90 ];
  printf "\n\nGenerating Github link : %s\n" $w
  wget $w -O /tmp/github_link_extractor
  cat /tmp/github_link_extractor | tr ' ' '\n' | tr '>' '\n' | grep -i "href=[^>]" | cut -d '"' -f 2 | uniq | sort | grep -e "/$USERNAME/.*" | xargs -n 1 -I% echo "" >> $OUTPUT_F ;

         token=$(cat /tmp/github_link_extractor | tr " " "\n" |grep -e "href="| tr ">" "\n" | grep -e "after" | cut -d"=" -f3 | cut -d"&" -f 1);

  echo $token;
  echo $((n--));


Usages :

./ github_user_name source links.txt

For More Updated Example, Check Github Here


Related Post

Top Visited

Big List Of Google Dorks For Sqli Injection

List of Keyboard Shortcuts Keys for GNOME Desktop (Kali linux / Linux / Ubuntu/*nix )

Create Simple Packet Sniffer Using Python

how to install burp suite in Linux/Ubuntu 16.04

How to create Phishing Page Using Kali Linux | Webpage Page Cloning Using Kali Linux Social Engineering Toolkit

Best 1000 User-agents List For Web Scraping

How To Install GDB Peda?

Latest Google Dorks List

2 Easiest Way To Enable Monitor Mode in Kali Linux | Airmon-ng | Iwconfig

How To Create Snake Game Using Python And Tkinter - Simple python games