Advertisement
Guest User

Untitled

a guest
May 16th, 2018
1,046
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.96 KB | None | 0 0
  1. <?php
  2.  
  3. /*
  4.  * Source Natt Consultas
  5.  * [Necessita de uso de cookie] & [Metodo pra bombear cookie]
  6.  * Desenvolvida por Kobra
  7.  */
  8.  
  9. error_reporting(1);
  10. extract($_GET);
  11. $pontuacao = 0;
  12.  
  13. define("sess","u2079aj3164fltl9oie9ji6c12");
  14.  
  15. function inStr($string, $start, $end, $value) {
  16.     $str = explode($start, $string);
  17.     $str = explode($end, $str[$value]);
  18.     return $str[0];
  19. }
  20.  
  21. $ch = curl_init();
  22. curl_setopt($ch, CURLOPT_URL, 'https://www.natt.com.br/sistema/consultas/cpf/Resposta0101.php');
  23. curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
  24. curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
  25. curl_setopt($ch, CURLOPT_HTTPHEADER, array(
  26.     'Cookie: PHPSESSID='.sess,
  27.     'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8',
  28.     'Accept-Language: pt-BR,pt;q=0.9,en-US;q=0.8,en;q=0.7',
  29.     'Connection: keep-alive',
  30.     'Referer: https://www.natt.com.br/sistema/consultas/painel.php',
  31.     'User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.62 Safari/537.36',
  32.     'Upgrade-Insecure-Requests: 1',
  33. ));
  34. curl_setopt($ch, CURLOPT_POST, 1);
  35. curl_setopt($ch, CURLOPT_POSTFIELDS, 'e_cpf='.$cpf.'&e_cnpj=&e_telefone=');
  36. $exec = curl_exec($ch);
  37.  
  38. //Dados Principais
  39. $nome = inStr($exec, '<h3>', '</h3>', 1);
  40.  
  41. if (!empty($nome)) {
  42.     $pontuacao = $pontuacao + 7;
  43. }
  44. $cpf = inStr($exec, '<td width="40%" align="left">', '</td>', 1);
  45. if (!empty($cpf)) {
  46.     $pontuacao = $pontuacao + 7;
  47. }
  48. $emissor = inStr($exec, '<td width="20%" align="left">', '</td>', 1);
  49. if (!empty($emissor)) {
  50.     $pontuacao = $pontuacao + 7;
  51. }
  52. $mae = str_replace("'", "", inStr($exec, "javascript:consultarNome('", "'", 1));
  53. if (!empty($mae)) {
  54.     $pontuacao = $pontuacao + 7;
  55. }
  56. $nascimento = inStr($exec, '<td width="40%" align="left">', '</td>', 2);
  57. if (!empty($nascimento)) {
  58.     $pontuacao = $pontuacao + 7;
  59. }
  60. $genero = inStr($exec, '<td width="20%" align="left">', '</td>', 2);
  61. if ($genero == "-") {
  62.     $pontuacao = $pontuacao + 7;
  63. }
  64. $email = inStr($exec, '<td width="80%" align="left" colspan="3">', '</td>', 2);
  65. if ($genero == "-") {
  66.     $pontuacao = $pontuacao + 7;
  67. }
  68. $situacao = strip_tags(inStr($exec, '<td width="50%" align="center" colspan="3">', '</td>', 1));
  69. if (!empty($situacao)) {
  70.     $pontuacao = $pontuacao + 7;
  71. }
  72. //
  73. //Endereços
  74. $tabela = inStr($exec, '<table width="100%" border=1 cellspacing=0 cellpadding=2 bordercolor="#e8ecf6" id="cTable">', '</table>', 2);
  75. $enderecos = "";
  76. $count = substr_count($tabela, '<td width="60%">');
  77. for ($i = 1; $i <= $count; $i++) {
  78.     $enderecos = $enderecos . "Endereço $i: " . strip_tags(inStr($tabela, '<td width="60%">', '</td>', $i)) . "\n";
  79. }
  80. if (!empty($enderecos)) {
  81.     $pontuacao = $pontuacao + 7;
  82. }
  83. //
  84. //Participação Societaria
  85. $tabela = inStr($exec, '<table width="100%" border=1 cellspacing=0 cellpadding=2 bordercolor="#e8ecf6" id="cTable">', '</table>', 3);
  86. $sociodesde = inStr($tabela, '<td width="8%" align="center">', '</td>', 1);
  87. $razao = inStr($tabela, '<td width="30%" align="center">', '</td>', 1);
  88. $cnpj = inStr($tabela, '<td width="15%" align="center">', '</td>', 1);
  89. $atividade = inStr($tabela, '<td width="35%" align="center">', '</td>', 1);
  90. if (!empty($sociodesde)) {
  91.     $participacaoFinal = "Participação Societaria: $cnpj | Socio desde: $sociodesde | Razão: $razao | Atividade: $atividade";
  92. }
  93. if (!empty($participacaoFinal)) {
  94.     $pontuacao = $pontuacao + 7;
  95. }
  96. //
  97. //Telefones Fixos
  98. $tabela = inStr($exec, '<table width="100%" border=1 cellspacing=0 cellpadding=2 bordercolor="#e8ecf6" id="cTable">', '</table>', 5);
  99. $count = substr_count($tabela, '<tr');
  100. $fixos = "";
  101. for ($i = 1; $i <= $count; $i++) {
  102.     $pega = inStr($tabela, '<tr', '</tr>', $i);
  103.     $numero = inStr($tabela, '<td width="15%" align="center">', '</td>', 1);
  104.     $endereco = inStr($tabela, '<td width="75%">', '</td>', 1);
  105.     $fixos = $fixos . "Fixo $i: Numero: $numero | Endereço de Cadastro: $endereço\n";
  106. }
  107. if (!empty($fixos)) {
  108.     $pontuacao = $pontuacao + 7;
  109. }
  110. //
  111. //Telefones Fixos que já pertenceram
  112. $tabela = inStr($exec, '<table width="100%" border=1 cellspacing=0 cellpadding=2 bordercolor="#e8ecf6" id="cTable">', '</table>', 7);
  113. $pertenceram = null;
  114. $count = substr_count($tabela, '<tr class="elink">');
  115. for ($i = 1; $i <= $count; $i++) {
  116.     $tab = inStr($tabela, '<tr class="elink">', '</tr>', $i);
  117.     $mesAno = inStr($tab, '<td width="10%" align="center">', '</td>', 1);
  118.     $telefone = inStr($tab, '<td width="15%" align="center">', '</td>', 1);
  119.     $atualProprietario = inStr($tab, '<td width="25%">', '</td>', 1);
  120.     $enderecoInstalacaoEpoca = inStr($tab, '<td width="40%">', '</td>', 1);
  121.     $pertenceram = $pertenceram . "Fixo Antigo $i: $telefone | Mês/Ano: $mesAno | Atual Proprietário: $atualProprietario | Endereço de Instalação na Época: $enderecoInstalacaoEpoca\n";
  122. }
  123. if (!empty($pertenceram)) {
  124.     $pontuacao = $pontuacao + 7;
  125. }
  126. //
  127. //Celulares
  128. $tabela = inStr($exec, '<table width="100%" border=1 cellspacing=0 cellpadding=2 bordercolor="#e8ecf6" id="cTable">', '</table>', 9);
  129. $count = substr_count($tabela, '<tr');
  130. $numeros = "";
  131. for ($i = 1; $i <= $count; $i++) {
  132.     $tab = inStr($tabela, '<tr', '</tr>', $i);
  133.     $numero = trim(inStr($tab, '<td width="15%" align="center">', '</td>', 1));
  134.     $endereco = trim(inStr($tab, '<td width="75%">', '</td>', 1));
  135.     if (!empty($numero)) {
  136.         $numeros .= "Celular $i: $numero | Endereço: $endereco\n";
  137.     }
  138. }
  139. if (!empty($numeros)) {
  140.     $pontuacao = $pontuacao + 7;
  141. }
  142. //
  143. //Possiveis Familiares
  144. $tabela = inStr($exec, '<table width="100%" border=1 cellspacing=0 cellpadding=2 bordercolor="#C6E2FF" id="cTable">', '</table>', 2);
  145. $count = substr_count($tabela, '<tr class="elink"');
  146. $familiares = "";
  147. for ($i = 1; $i <= $count; $i++) {
  148.     $tab = inStr($tabela, '<tr class="elink"', '</tr>', $i);
  149.     $grau = inStr($tab, '<td width="10%" align="center">', '</td>', 1);
  150.     $familiarNome = inStr($tab, '<td width="35%" align="left">', '</td>', 1);
  151.     $cidadeUF = inStr($tab, '<td width="30%" align="left">', '</td>', 1);
  152.     $cpfFamiliar = inStr($tab, '<td width="35%" align="left">', '</td>', 2);
  153.     if (!empty($nome)) {
  154.         $familiares .= "Familiar $i: $familiarNome | Grau: $grau | Cidade: $cidadeUF | Cpf: $cpfFamiliar\n";
  155.     }
  156. }
  157. if (!empty($familiares)) {
  158.     $pontuacao = $pontuacao + 7;
  159. }
  160. //
  161. if ($pontuacao < 20) {
  162.     $pontuacao = "$pontuacao% - [PÉSSIMA]";
  163. } elseif ($pontuacao > 20 && $pontuacao < 40) {
  164.     $pontuacao = "$pontuacao% - [DÁ PRO GASTO]";
  165. } elseif ($pontuacao > 40 && $pontuacao < 80) {
  166.     $pontuacao = "$pontuacao% - [TOPPER]";
  167. } elseif ($pontuacao > 80) {
  168.     $pontuacao = "$pontuacao% - [LENDÁRIA]";
  169. }
  170. echo json_encode(array("str" => "Nome: $nome\nCpf: $cpf\nEmissor: $emissor\nNome da mãe: $mae\nData de nascimento: $nascimento\nGenero: $genero\nEmail: $email\nSituação no banco central: $situacao\n$enderecos$participacaoFinal$fixos$pertenceram$numeros$familiares", "pontuacao" => $pontuacao));
  171. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement