Skip to content

Commit

Permalink
Nozomi Hackeado
Browse files Browse the repository at this point in the history
Hace un tiempo hackié el servidor nozomi el cual cuenta con 3 keys para poder acceder a sus videos tanto para verlos online como para descargar, así que ahora lo implementé en el port de Switch.
  • Loading branch information
darkxex committed May 4, 2021
1 parent dba694c commit 50a8b94
Show file tree
Hide file tree
Showing 10 changed files with 186 additions and 11 deletions.
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ include $(DEVKITPRO)/libnx/switch_rules
# - <libnx folder>/default_icon.jpg
#---------------------------------------------------------------------------------
VERSION_MAJOR := 1
VERSION_MINOR := 8
VERSION_MICRO := 4
VERSION_MINOR := 9
VERSION_MICRO := 0

APP_TITLE := RipJKAnime NX
APP_AUTHOR := AngelXex
Expand Down
4 changes: 2 additions & 2 deletions compile.bat
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,11 @@ make -j7
set a=%errorlevel%
echo ------------------------------------------

make -C RipJKForwader -j7
make -C RipJKForwader -j20
copy "RipJKForwader\Output\RipJKForwader[05B9DB505ABBE000][v0].nsp" "out\RipJKForwader[05B9DB505ABBE000][v0].nsp"

if %a% equ 0 color 0a
if %a% equ 0 "C:\devkitPro\tools\bin\nxlink.exe" "out\RipJKAnime_NX.nro" -p RipJKAnime_NX/RipJKAnime_NX.nro -s
if %a% equ 0 "C:\devkitPro\tools\bin\nxlink.exe" "out\RipJKAnime_NX.nro" -s -a 192.168.0.9

echo -----------------------------------

Expand Down
Binary file modified out/RipJKAnime NX[05B9DB505ABBE000][v0].nsp
Binary file not shown.
Binary file modified out/RipJKForwader[05B9DB505ABBE000][v0].nsp
Binary file not shown.
4 changes: 2 additions & 2 deletions source/JKanime.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,11 @@ void blinkLed(u8 times);
#endif // ___SWITCH___

std::vector<std::string> arrayservers= {
"Desu", "Xtreme S", "MixDrop", "Okru", "Fembed"
"Nozomi","Desu", "Xtreme S", "MixDrop", "Okru", "Fembed"
};

std::vector<std::string> arrayserversbak= {
"Desu", "Xtreme S", "MixDrop", "Okru", "Fembed"
"Nozomi","Desu", "Xtreme S", "MixDrop", "Okru", "Fembed"
};
/*
std::vector<std::string> arrayserversbak= {
Expand Down
143 changes: 143 additions & 0 deletions source/NozomiHacked.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,143 @@
#include <switch.h>
#include <curl/curl.h>
#include <string>
#include <iostream>
#include <vector>
#include <fstream>
#include <stdlib.h>
#include <stdio.h>
#include <chrono>
#include <thread>
#include <math.h>
#include <cstring>
#include <sys/stat.h>
#include "Networking.hpp"
#include "utils.hpp"
#include <ctime>

static size_t SecondCallback(void *contents, size_t size, size_t nmemb, void *userp)
{
((std::string*)userp)->append((char*)contents, size * nmemb);
return size * nmemb;
}
std::string getFirstKey(std::string enlace)
{

CURL *curl;
CURLcode res = CURLE_OK;
std::string Buffer;

curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_URL, enlace.c_str());
curl_easy_setopt(curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36");
curl_easy_setopt(curl, CURLOPT_REFERER, "https://jkanime.net/");
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, SecondCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &Buffer);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
if (res != CURLE_OK){printf("\n%s\n",curl_easy_strerror(res));}
}

std::string codetemp = Buffer;
int temp1, temp2;
temp1 = codetemp.find("name=\"data\" value=\"");
temp1 = temp1 +19;
temp2 = codetemp.find("\"",temp1);
codetemp = codetemp.substr(temp1,temp2 - temp1);
std::cout << "FirstKey: "<< codetemp << std::endl;
Buffer = codetemp;
return Buffer;
}
std::string getSecondKey(std::string data)
{
data = "data=" + data;
std::string redirected = "";
CURL *curl;
CURLcode curl_res;

curl_global_init(CURL_GLOBAL_ALL);

curl = curl_easy_init();

if (curl)
{

curl_easy_setopt(curl, CURLOPT_URL, "https://jkanime.net/gsplay/redirect_post.php");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data.c_str());
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1);

curl_easy_setopt(curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36");
curl_easy_setopt(curl, CURLOPT_REFERER, "https://jkanime.net/");

/* Perform the request, curl_res will get the return code */
curl_res = curl_easy_perform(curl);

/* Check for errors */
if(curl_res != CURLE_OK)
fprintf(stderr, "curl_easy_perform() failed: %s\n",
curl_easy_strerror(curl_res));

if(CURLE_OK == curl_res)
{
char *url;
curl_res = curl_easy_getinfo(curl, CURLINFO_EFFECTIVE_URL, &url);

if((CURLE_OK == curl_res) && url)
{ printf("CURLINFO_EFFECTIVE_URL: %s\n", url);
redirected = url;}
}

/* always cleanup */
curl_easy_cleanup(curl);

/* we're done with libcurl, so clean it up */
curl_global_cleanup();

}
else
{
printf("cURL error.\n");
}
std::cout << "Secondkey: "<< redirected << std::endl;
return redirected;

}

std::string getThirdKey(std::string secondKey)
{

CURL *curl;
CURLcode res = CURLE_OK;
std::string Buffer;
std::string second = "v=" + secondKey;
replace(second,"https://jkanime.net/gsplay/player.html#","");
curl = curl_easy_init();
if (curl) {
curl_easy_setopt(curl, CURLOPT_URL, "https://jkanime.net/gsplay/api.php");
curl_easy_setopt(curl, CURLOPT_USERAGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.169 Safari/537.36");
curl_easy_setopt(curl, CURLOPT_REFERER, "https://jkanime.net/");
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, second.c_str());
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L);
curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L);
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, SecondCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, &Buffer);
res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
if (res != CURLE_OK){printf("\n%s\n",curl_easy_strerror(res));}
}

std::string codetemp = Buffer;
int temp1, temp2;
temp1 = codetemp.find("https:");
temp2 = codetemp.find("\"",temp1);
codetemp = codetemp.substr(temp1,temp2 - temp1);
replace(codetemp,"\\","");
std::cout << "ThirdKey: "<< codetemp << std::endl;
Buffer = codetemp;
return Buffer;
}
7 changes: 7 additions & 0 deletions source/NozomiHacked.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <switch.h>
#include <curl/curl.h>
#include <string>

std::string getFirstKey(std::string enlace);
std::string getSecondKey(std::string data);
std::string getThirdKey(std::string secondKey);
3 changes: 1 addition & 2 deletions source/applet.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#include <cstring>
#include <switch.h>
#ifdef __SWITCH__
#include <unistd.h>
#include <iostream>
#include <ostream>
Expand Down Expand Up @@ -133,4 +132,4 @@ Result WebBrowserCall(std::string url,bool nag){
}

//KeyboardCall ("Buscar Anime (3 letras minimo.)", "");
#endif

6 changes: 3 additions & 3 deletions source/main.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#ifdef __SWITCH__
#ifdef __SWITCH__
#include <unistd.h>
#include <switch.h>
#include <dirent.h>
Expand Down Expand Up @@ -1011,7 +1011,7 @@ int main(int argc, char **argv)
#else
std::string TYPEA = "sdmc";
#endif
gTextTexture.loadFromRenderedText(GOD.gFont, (TYPEA+" (Ver "+VERCAT+") #KASTXUPALO").c_str(), {100,0,0});
gTextTexture.loadFromRenderedText(GOD.gFont, (TYPEA+" (Ver "+VERCAT+") #PIÑERAXUPALO").c_str(), {100,0,0});
gTextTexture.render(SCREEN_WIDTH - gTextTexture.getWidth() - 30, 20);
if (imgNumbuffer > 0){
gTextTexture.loadFromRenderedText(GOD.gFont, "Imagenes: ("+std::to_string(imgNumbuffer)+"/30)", {0,100,0});
Expand Down Expand Up @@ -1205,7 +1205,7 @@ int main(int argc, char **argv)
if (std::to_string(porcendown) == "100"&&!isDownloading) {
//Render red filled quad
VOX.render_VOX({ posxbase + 98, posybase + 400, 580, 50 }, 255, 255, 255, 255);
gTextTexture.loadFromRenderedText(GOD.gFont3, "¡Descarga Completada! Revisa tu SD.", textColor);
gTextTexture.loadFromRenderedText(GOD.gFont3, "�Descarga Completada! Revisa tu SD.", textColor);
gTextTexture.render(posxbase + 100, posybase + 400);
}else{
VOX.render_VOX({ posxbase + 340, posybase + 150, 500, 50 }, 255, 255, 255, 145);
Expand Down
26 changes: 26 additions & 0 deletions source/utils.cpp
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@

#include <string>
#include <math.h>
#include <stdio.h>
Expand All @@ -12,13 +13,15 @@
#include <thread>
#include "utils.hpp"
#include "Networking.hpp"
#include "NozomiHacked.hpp"
#include <SDL.h>
#include <SDL_thread.h>
#include <SDL_image.h>
#include <SDL_ttf.h>
#include <SDL_mixer.h>
#include "applet.hpp"
#include "SDLWork.hpp"

extern SDLB GOD;
extern std::string serverenlace;

Expand Down Expand Up @@ -101,6 +104,7 @@ while (true){
return decode;
}


bool onlinejkanimevideo(std::string onlineenlace,std::string server)
{
std::string text = "Cargando... "+onlineenlace.substr(0,62)+"... desde "+server;
Expand All @@ -114,6 +118,7 @@ bool onlinejkanimevideo(std::string onlineenlace,std::string server)
std::string tempcon = "";
content = gethtml(onlineenlace);


if (server == "Okru"){
videourl = scrapElement(content,"https://jkanime.net/jkokru.php?");
replace(videourl, "https://jkanime.net/jkokru.php?u=", "https://ok.ru/videoembed/");
Expand All @@ -139,7 +144,12 @@ bool onlinejkanimevideo(std::string onlineenlace,std::string server)
}
}
if (server == "Nozomi"){

videourl = scrapElement(content,"https://jkanime.net/um2.php?");
videourl = getFirstKey(videourl);
videourl = getSecondKey(videourl);


}
if (server == "Mega"){
videourl = scrapElement(content,"https://mega.nz/embed/");
Expand All @@ -163,6 +173,22 @@ bool linktodownoadjkanime(std::string urltodownload,std::string directorydownloa
std::string content = "";
content = gethtml(urltodownload);



videourl = scrapElement(content, "https://jkanime.net/um2.php?");
if(videourl.length())
{
videourl = getFirstKey(videourl);
videourl = getSecondKey(videourl);
if(videourl.length())
{
videourl = getThirdKey(videourl);
std::cout << videourl << std::endl;
serverenlace = videourl;
if(downloadfile(videourl, directorydownload)) return true;
}
}

videourl = scrapElement(content, "https://www.mediafire.com/file/");
if(videourl.length())
{
Expand Down

0 comments on commit 50a8b94

Please sign in to comment.