여러 내용 수정...

This commit is contained in:
Hakase
2018-03-22 21:18:45 +09:00
parent 7b5994acea
commit da5d8223b2
6 changed files with 203 additions and 36 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
MIT License MIT License
Copyright (c) 2016-2017 hakasenyang Copyright (c) 2016-2018 hakasenyang
Permission is hereby granted, free of charge, to any person obtaining a copy Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal of this software and associated documentation files (the "Software"), to deal
+184 -5
View File
@@ -1,7 +1,43 @@
<?php <?php
class Marumaru { class Marumaru {
private $httph = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.116 Safari/537.36'; private $httph = 'Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/62.0.3202.89 Safari/537.36';
private $fname = 'cookie.txt'; private $fname = 'cookie_hidden.txt';
public function linkencode ($url) {
$ta = parse_url($url);
if (!empty($ta['scheme']))
$ta['scheme'] .= '://';
if (!empty($ta['pass']) and !empty($ta['user']))
{
$ta['user'] = ':';
$ta['pass'] = rawurlencode($ta['pass']).'@';
}
elseif (!empty($ta['user']))
$ta['user'] .= '@';
if (!empty($ta['port']) and !empty($ta['host']))
$ta['host'] = ''.$ta['host'].':';
elseif (!empty($ta['host']))
$ta['host'] = $ta['host'];
if (!empty($ta['path']))
{
$tu = '';
$tok = strtok($ta['path'], "\\/");
while (strlen($tok))
{
$tu .= rawurlencode($tok).'/';
$tok = strtok("\\/");
}
$ta['path'] = '/'.trim($tu, '/');
}
if (!empty($ta['query']))
$ta['query'] = '?'.$ta['query'];
if (!empty($ta['fragment']))
$ta['fragment'] = '#'.$ta['fragment'];
return implode('', array($ta['scheme'], $ta['user'], $ta['pass'], $ta['host'], $ta['port'], $ta['path'], $ta['query'], $ta['fragment']));
}
public function splits($data, $first, $end, $num = 1) public function splits($data, $first, $end, $num = 1)
{ {
$temp = @explode($first, $data); $temp = @explode($first, $data);
@@ -11,11 +47,13 @@
} }
public function WEBParsing($url, $cookie=NULL, $headershow=TRUE, $postparam=NULL, $otherheader=NULL) public function WEBParsing($url, $cookie=NULL, $headershow=TRUE, $postparam=NULL, $otherheader=NULL)
{ {
if (!preg_match('/^(?:https?):\/\//', $url)) return false;
$ch = curl_init(); $ch = curl_init();
$url = $this->linkencode($url);
$opts = array(CURLOPT_RETURNTRANSFER => true, $opts = array(CURLOPT_RETURNTRANSFER => true,
CURLOPT_URL => $url, CURLOPT_URL => $url,
CURLOPT_TIMEOUT => 10, CURLOPT_TIMEOUT => 60,
CURLOPT_CONNECTTIMEOUT => 5, CURLOPT_CONNECTTIMEOUT => 10,
CURLOPT_SSL_VERIFYPEER => FALSE, CURLOPT_SSL_VERIFYPEER => FALSE,
CURLOPT_HEADER => $headershow, CURLOPT_HEADER => $headershow,
CURLOPT_USERAGENT => $this->httph CURLOPT_USERAGENT => $this->httph
@@ -35,6 +73,144 @@
curl_close($ch); curl_close($ch);
return ($data) ? $data : false; return ($data) ? $data : false;
} }
/**
* sucuri - sucuri 프록시 관련 쿠키 우회
* 소스 : https://github.com/organization/cloudflare-bypass
* 소스 : http://cafe.naver.com/gogoomas/337647
* @param string $result 쿠키 string 입력
* @return strring 쿠키 데이터 출력
* 사용하지 않음.
*/
/*public function sucuri($result)
{
if(strpos($result, 'sucuri_cloudproxy_js') !== false)
{
$cp_temp1 = explode('S=\'', $result);
$cp_temp2 = explode(';', $cp_temp1[1]);
$cp_script = $cp_temp2[0];
$cp_temp1 = explode('A=\'', $result);
$cp_temp2 = explode('\';', $cp_temp1[1]);
$cp_chlist = $cp_temp2[0];
$cp_charr = array();
for($i = 0; $i < 64; $i++)
$cp_charr[$cp_chlist[$i]] = $i;
$cp_len = strlen($cp_script);
$cp_c = 0;
$cp_u = 0;
$cp_i = 0;
$cp_l = 0;
$cp_a = NULL;
$cp_r = NULL;
for($i = 0; $i < $cp_len; $i++)
{
$cp_c = $cp_charr[$cp_script[$i]];
$cp_u = ($cp_u << 6) + $cp_c;
$cp_l += 6;
while($cp_l >= 8)
(($cp_a = ($cp_u >> ($cp_l -= 8)) & 0xff) || ($cp_i < ($cp_len - 2))) && ($cp_r .= chr($cp_a));
}
$cp_temp1 = explode('document.cookie=', $cp_r);
$cp_temp2 = explode('=', $cp_temp1[1]);
$cp_cnam = str_replace('"', '\'', $cp_temp2[0]);
$cp_cnam_split = explode('+', $cp_cnam);
$cp_cnam_split_cnt = count($cp_cnam_split);
$cp_cnam_string = NULL;
for($i = 0 ; $i < $cp_cnam_split_cnt; $i++)
{
$cp_cnam = trim($cp_cnam_split[$i]);
if(strpos($cp_cnam, 'slice') !== false)
{
$cp_temp1 = explode('\'', $cp_cnam);
$cp_temp2 = explode('(', $cp_cnam);
$cp_temp3 = explode(')', $cp_temp2[1]);
$cp_temp4 = explode(',', $cp_temp3[0]);
$cp_cnam_string .= substr($cp_temp1[1], trim($cp_temp4[0]), (intval(trim($cp_temp4[1])-trim($cp_temp4[0]))));
}
elseif(strpos($cp_cnam, 'charAt') !== false)
{
$cp_temp1 = explode('\'', $cp_cnam);
$cp_temp2 = explode('(', $cp_cnam);
$cp_temp3 = explode(')', $cp_temp2[1]);
$cp_cnam_string .= substr($cp_temp1[1], trim($cp_temp3[0]), 1);
}
elseif(strpos($cp_cnam, 'String.fromCharCode') !== false)
{
$cp_temp1 = explode('(', $cp_cnam);
$cp_temp2 = explode(')', $cp_temp1[1]);
if(strpos($cp_temp2[0], '0x') !== false)
$cp_cnam_string .= chr(hexdec($cp_temp2[0]));
else
$cp_cnam_string .= chr($cp_temp2[0]);
}
elseif(strpos($cp_cnam, 'substr') !== false)
{
$cp_temp1 = explode('\'', $cp_cnam);
$cp_temp2 = explode('(', $cp_cnam);
$cp_temp3 = explode(')', $cp_temp2[1]);
$cp_temp4 = explode(',', $cp_temp3[0]);
$cp_cnam_string .= substr($cp_temp1[1], trim($cp_temp4[0]), trim($cp_temp4[1]));
}
else
$cp_cnam_string .= trim(trim($cp_cnam, '\''));
$cp_cnam_string .= NULL;
}
//$cp_temp1 = explode('=', $cp_r);
$cp_temp1 = strpos($cp_r, '=');
$cp_temp2 = explode(';document.cookie', substr($cp_r, $cp_temp1+1)); //$cp_temp[1]
$cp_cval = str_replace('"', '\'', $cp_temp2[0]);
$cp_cval_split = explode('+', $cp_cval);
$cp_cval_split_cnt = count($cp_cval_split);
$cp_cval_string = null;
for($i = 0 ; $i < $cp_cval_split_cnt; $i++)
{
$cp_nval = trim($cp_cval_split[$i]);
if(strpos($cp_nval, 'slice') !== false)
{
$cp_temp1 = explode('\'', $cp_nval);
$cp_temp2 = explode('(', $cp_nval);
$cp_temp3 = explode(')', $cp_temp2[1]);
$cp_temp4 = explode(',', $cp_temp3[0]);
$cp_cval_string .= substr($cp_temp1[1], trim($cp_temp4[0]), (intval(trim($cp_temp4[1])-trim($cp_temp4[0]))));
}
elseif(strpos($cp_nval, 'charAt') !== false)
{
$cp_temp1 = explode("'", $cp_nval);
$cp_temp2 = explode("(", $cp_nval);
$cp_temp3 = explode(")", $cp_temp2[1]);
$cp_cval_string .= substr($cp_temp1[1], trim($cp_temp3[0]), 1);
}
elseif(strpos($cp_nval, 'String.fromCharCode') !== false)
{
$cp_temp1 = explode('(', $cp_nval);
$cp_temp2 = explode(')', $cp_temp1[1]);
if(strpos($cp_temp2[0], '0x') !== false)
{
$cp_cval_string .= chr(hexdec($cp_temp2[0]));
}
else
{
$cp_cval_string .= chr($cp_temp2[0]);
}
}
elseif(strpos($cp_nval, 'substr') !== false)
{
$cp_temp1 = explode('\'', $cp_nval);
$cp_temp2 = explode('(', $cp_nval);
$cp_temp3 = explode(')', $cp_temp2[1]);
$cp_temp4 = explode(',', $cp_temp3[0]);
$cp_cval_string .= substr($cp_temp1[1], trim($cp_temp4[0]), trim($cp_temp4[1]));
}
else
{
$cp_cval_string .= trim(trim($cp_nval, '\''));
}
$cp_cval_string .= NULL;
}
// String Output
return $cp_cnam_string."=".$cp_cval_string;
}
}*/
public function FileRead($filename=NULL) public function FileRead($filename=NULL)
{ {
$filename = ($filename) ? $filename : $this->fname; $filename = ($filename) ? $filename : $this->fname;
@@ -55,6 +231,9 @@
} }
public function GetCookie() public function GetCookie()
{ {
/*$data = $this->WEBParsing('http://wasabisyrup.com/archives/');
$cookie = $this->splits($data, '<script>', '</script>');
$cookie = $this->sucuri($cookie);*/
$data = $this->WEBParsing('http://wasabisyrup.com/archives/455742', $cookie, true, 'pass=qndxkr', $data = $this->WEBParsing('http://wasabisyrup.com/archives/455742', $cookie, true, 'pass=qndxkr',
array( array(
'Referer: http://wasabisyrup.com/' 'Referer: http://wasabisyrup.com/'
@@ -88,7 +267,7 @@
$err='Not found comics data'; $err='Not found comics data';
break; break;
default: default:
$err='Unknown Error. Please send me an e-mail (contact@hakase.kr)'; $err='Unknown Error. Please send me an e-mail (hakase@hakase.io)';
} }
die(json_encode(array('error'=>$num, 'message'=>$err))); die(json_encode(array('error'=>$num, 'message'=>$err)));
} }
+5 -5
View File
@@ -4,15 +4,15 @@
<meta charset="utf-8"> <meta charset="utf-8">
<meta name="viewport" content="width=500, user-scalable=no"> <meta name="viewport" content="width=500, user-scalable=no">
<title>fmaru php porting by hakase</title> <title>fmaru php porting by hakase</title>
<link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css"> <!-- <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css"> -->
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/twitter-bootstrap/3.3.7/css/bootstrap.css">
<!--<link href="https://fonts.googleapis.com/icon?family=Material+Icons" <!--<link href="https://fonts.googleapis.com/icon?family=Material+Icons"
rel="stylesheet">--> rel="stylesheet">-->
<link href="style.css" <link href="style.css" rel="stylesheet">
rel="stylesheet">
</head> </head>
<body style="margin:0px"> <body style="margin:0px">
<div id="contents"></div> <div id="contents"></div>
<script src="config.js?2017010701"></script> <script src="config.js?2018021101"></script>
<script src="app.js?2017010701"></script> <script src="app.js?2018021101"></script>
</body> </body>
</html> </html>
+5 -17
View File
@@ -8,16 +8,6 @@
if(isset($imgurl)) if(isset($imgurl))
{ {
$a = parse_url($imgurl); $a = parse_url($imgurl);
// Insecure checkup causes RFI
switch($a['scheme'])
{
case 'http':
case 'https':
break;
default:
exit;
}
switch($a['host']) switch($a['host'])
{ {
case 'www.yuncomics.com': case 'www.yuncomics.com':
@@ -40,7 +30,6 @@
exit(); exit();
} }
} }
header('Cache-Control: max-age=86400, public'); header('Cache-Control: max-age=86400, public');
header('Expires: '. gmdate('D, d M Y H:i:s \G\M\T', time() + 86400)); header('Expires: '. gmdate('D, d M Y H:i:s \G\M\T', time() + 86400));
header('Last-Modified: ' . gmdate('D, d M Y H:i:s',time() + 86400 ) . ' GMT' ); header('Last-Modified: ' . gmdate('D, d M Y H:i:s',time() + 86400 ) . ' GMT' );
@@ -80,11 +69,11 @@ Number 2 : Cookie Get Error<br>
Number 3 : Password Error (Protected archive) - Retry 10 minutes after view or retry about 3 times)<br> Number 3 : Password Error (Protected archive) - Retry 10 minutes after view or retry about 3 times)<br>
Number 4 : Not found comics data<br> Number 4 : Not found comics data<br>
Other error : read the message</p> Other error : read the message</p>
<p>Output only JSON (Example) {"error":1,"message":"Error Message)"}<br> <p>Output only JSON (Example) {"error":1,"message":"Error Message"}<br>
Only error / message method use</p> Only error / message method use</p>
<h2>Etc...</h2> <h2>Etc...</h2>
<p><strong><i><u><a href="https://github.com/hakasenyang/marumaru-php-parser" target="_blank">Open Source</a></u></i></strong></p> <p><strong><i><u><a href="https://github.com/hakasenyang/marumaru-php-parser" target="_blank">Open Source</a></u></i></strong></p>
<p>Developed by <a href="https://keybase.io/hakasekr" rel="noreferrer" target="_blank">Hakase</a> (contact@hakase.kr)<br> <p>Developed by <a href="https://keybase.io/hakasekr" rel="noreferrer" target="_blank">Hakase</a> (hakase@hakase.io)<br>
사용은 자유고 제한 없음. 애초에 제한 있으면 API 인증키를 넣겠지만 귀찮아서 안 넣음. 사용은 자유고 제한 없음. 애초에 제한 있으면 API 인증키를 넣겠지만 귀찮아서 안 넣음.
</p> </p>
</body> </body>
@@ -145,13 +134,12 @@ startdata:
if ($image) if ($image)
{ {
$jsonon = ($_GET['json'] == 1) ? true : false; $jsonon = ($_GET['json'] == 1) ? true : false;
for($i=1,$cnt=(count($aaa));$i<$cnt;$i++)
for($i=1;$i<count($aaa);$i++)
echo '<img src="?imgurl='.urlencode(trim(explode('"', $aaa[$i])[0])).'"><br>'; echo '<img src="?imgurl='.urlencode(trim(explode('"', $aaa[$i])[0])).'"><br>';
} }
else else
{ {
for($i=1;$i<count($data2);$i++) for($i=1,$cnt=count($data2);$i<$cnt;$i++)
{ {
if($num == trim(explode('" >', $data2[$i])[0])) if($num == trim(explode('" >', $data2[$i])[0]))
{ {
@@ -180,7 +168,7 @@ startdata:
else else
$aad[] = ['next'=>null]; $aad[] = ['next'=>null];
} }
for($i=2;$i<count($aaa)-1;$i++) for($i=1,$cnt=(count($aaa));$i<$cnt;$i++)
$aab[] = trim(explode('"', $aaa[$i])[0]); $aab[] = trim(explode('"', $aaa[$i])[0]);
if($jsonon) if($jsonon)
+2 -2
View File
@@ -1,12 +1,12 @@
<?php <?php
include_once '_function.php'; include_once '_function.php';
$marumaru = new Marumaru(); $marumaru = new Marumaru();
$data = $marumaru->WEBParsing('http://marumaru.in/'.$_GET['href']); $data = $marumaru->WEBParsing('https://marumaru.in/'.$_GET['href']);
$data = str_replace('class="con_link" ', 'target="_blank" ', $data); $data = str_replace('class="con_link" ', 'target="_blank" ', $data);
$data = preg_replace('/(<[^>]+) style=".*?"/i', '$1', $data); $data = preg_replace('/(<[^>]+) style=".*?"/i', '$1', $data);
$thumb = $marumaru->splits($data, '<meta property="og:image" content="', '"'); $thumb = $marumaru->splits($data, '<meta property="og:image" content="', '"');
$a = explode('<a target="_blank" href="', $data); $a = explode('<a target="_blank" href="', $data);
for($i=1;$i<count($a);$i++) for($i=1,$cnt=count($a);$i<$cnt;$i++)
{ {
$href = explode('/', explode('"', $a[$i])[0])[4]; $href = explode('/', explode('"', $a[$i])[0])[4];
$title = str_replace('&nbsp;', ' ', strip_tags('<a target="_blank" href="'.explode('</a>', $a[$i])[0])); $title = str_replace('&nbsp;', ' ', strip_tags('<a target="_blank" href="'.explode('</a>', $a[$i])[0]));
+3 -3
View File
@@ -4,17 +4,17 @@
$file = $marumaru->FileRead('mangalist.txt'); $file = $marumaru->FileRead('mangalist.txt');
if(!isset($file) || @explode(PHP_EOL, $file)[0] < time()) if(!isset($file) || @explode(PHP_EOL, $file)[0] < time())
{ {
$data = $marumaru->WEBParsing('http://marumaru.in/c/1'); $data = $marumaru->WEBParsing('https://marumaru.in/c/53');
$a = explode('" href="/b/manga/', $data); $a = explode('" href="/b/manga/', $data);
$b = explode('<div width="200"><', $data); $b = explode('<div width="200"><', $data);
for($i=1;$i<count($a);$i++) for($i=1,$cnt=count($a);$i<$cnt;$i++)
{ {
$name = strip_tags('<'.explode('</div>', $b[$i])[0]); $name = strip_tags('<'.explode('</div>', $b[$i])[0]);
$id = explode('"', $a[$i])[0]; $id = explode('"', $a[$i])[0];
$c[] = ['href'=>'/b/manga/'.$id, 'title'=>$name, 'id'=>$id]; $c[] = ['href'=>'/b/manga/'.$id, 'title'=>$name, 'id'=>$id];
} }
$file = json_encode(array('list'=>$c)); $file = json_encode(array('list'=>$c));
$marumaru->FileWrite($file, 'mangalist.txt'); $marumaru->FileWrite($file, 'mangalist.txt', (60*30));
echo $file; echo $file;
exit; exit;
} }