Jayapraveen / INE-courses-downloader

Python Script to download coures from INE.com website for personal and educational use
GNU General Public License v3.0
39 stars 19 forks source link

New Subscription added to INE #37

Open Lomar5115 opened 2 years ago

Lomar5115 commented 2 years ago

Hi broo's INE start's a new 7 day trial subscription, please Include it in the Script Couse now I can't download any course

ghost commented 2 years ago

it's this issue I posted fix for like a month ago.

there's no longer refresh in the json

view below thread linked below

https://github.com/Jayapraveen/INE-courses-downloader/issues/34

Lomar5115 commented 2 years ago

Thanks broo, You're a legend

Lomar5115 commented 2 years ago

it's this issue I posted fix for like a month ago.

there's no longer refresh in the json

view below thread linked below

34

Thanks an Advanced but Now it shows me that: You do not have the subscription/pass to access to this course

any solution ?

ghost commented 2 years ago

**try this

replace old course_has_access function**


def course_has_access(course):
    for passes in range(len(course["access"]["related_passes"]) -1 ,0,-1):
        boolean =  True if course["access"]["related_passes"][passes]["name"] in access_pass else False
        if(boolean):
            break
    return boolean

with this updated one

def course_has_access(course):
    global have_access
    have_access = False
    for passes in range(len(course["access"]["related_passes"])):
        try:
            have_access = True if course["access"]["related_passes"][passes]["name"] in access_pass else True
            if have_access == False:
                have_access = True if course["access"]["related_passes"][passes][0]["name"] in access_pass else True
        except:
            try:
                have_access = True if course["access"]["related_passes"][passes][0]["name"] in access_pass else True
            except:
                if(have_access):
                    break
    return have_access
Lomar5115 commented 2 years ago

**try this

replace old course_has_access function**


def course_has_access(course):
    for passes in range(len(course["access"]["related_passes"]) -1 ,0,-1):
        boolean =  True if course["access"]["related_passes"][passes]["name"] in access_pass else False
        if(boolean):
            break
    return boolean

with this updated one

def course_has_access(course):
    global have_access
    have_access = False
    for passes in range(len(course["access"]["related_passes"])):
        try:
            have_access = True if course["access"]["related_passes"][passes]["name"] in access_pass else True
            if have_access == False:
                have_access = True if course["access"]["related_passes"][passes][0]["name"] in access_pass else True
        except:
            try:
                have_access = True if course["access"]["related_passes"][passes][0]["name"] in access_pass else True
            except:
                if(have_access):
                    break
    return have_access

Thanks A lot broo, it works fine now .. but some labs not downloaded and cuase course download off, I faced this problem

File "C:\Users\USER\Desktop\INE-courses-downloader-master\Ine.py", line 765, in downloader(course) File "C:\Users\USER\Desktop\INE-courses-downloader-master\Ine.py", line 624, in downloader download_lab(k["uuid"], lab_index) File "C:\Users\USER\Desktop\INE-courses-downloader-master\Ine.py", line 341, in download_lab os.makedirs(subfolder_name.replace(':', '')) File "C:\Users\USER\AppData\Local\Programs\Python\Python310\lib\os.py", line 225, in makedirs mkdir(name, mode) OSError: [WinError 123] The filename, directory name, or volume label syntax is incorrect: 'Lab2.Windows Recon IIS Nmap Scripts\t'

And after that I tries to replace ":" with "." like in Issue #33

subfolder_name= subfolder_name.replace(':', '')

but same error occur

ghost commented 2 years ago

I dont think the labs download part works anymore.

the replace is removing the : from the string

you can try to add another replace below it. looks like there's a tab in the string \t

subfolder_name= subfolder_name.replace(':', '')
subfolder_name= subfolder_name.replace('\t', '')
Lomar5115 commented 2 years ago

I dont think the labs download part works anymore.

the replace is removing the : from the string

you can try to add another replace below it. looks like there's a tab in the string \t

subfolder_name= subfolder_name.replace(':', '')
subfolder_name= subfolder_name.replace('\t', '')

Thanks a lot bro and sorry to bother you .. Have you ever see this error?

Traceback (most recent call last): File "C:\Users\USER\Desktop\INE-courses-downloader-master\Ine.py", line 767, in downloader(course) File "C:\Users\USER\Desktop\INE-courses-downloader-master\Ine.py", line 626, in downloader download_lab(k["uuid"], lab_index) File "C:\Users\USER\Desktop\INE-courses-downloader-master\Ine.py", line 348, in download_lab with open(subfolder_name+"/index.html",'w',encoding='utf-8') as fp: FileNotFoundError: [Errno 2] No such file or directory: 'Lab2.Windows IIS Server WebDav Metasploit /index.html'

ghost commented 2 years ago

it's looking for a file that doesn't exist.

C:\Users\USER\Desktop\INE-courses-downloader-master / Lab2.Windows IIS Server WebDav Metasploit /index.html'

try changing this with open(subfolder_name+"/index.html",'w',encoding='utf-8') as fp:

to this with open(subfolder_name+"\index.html",'w',encoding='utf-8') as fp:

if that doesn't work try this:

make sure import os listed for imports at top

import os

save_path_wname = os.path.join(subfolder_name, 'index.html')
with open(save_path_wname,'w',encoding='utf-8') as fp:

BTW Is this the save labs function?

Lomar5115 commented 2 years ago

it's looking for a file that doesn't exist.

C:\Users\USER\Desktop\INE-courses-downloader-master / Lab2.Windows IIS Server WebDav Metasploit /index.html'

try changing this with open(subfolder_name+"/index.html",'w',encoding='utf-8') as fp:

to this with open(subfolder_name+"\index.html",'w',encoding='utf-8') as fp:

if that doesn't work try this:

make sure import os listed for imports at top

import os

save_path_wname = os.path.join('subfolder_name', 'index.html')
with open(save_path_wname,'w',encoding='utf-8') as fp:

BTW Is this the save labs function?

Yes it's .. I'll try then I'll tell you what happend, the script is working fine ror other courses it's only has a proplem when lab name has more than one (:) charecter like >> Windows: Meterpreter: Kiwi Extension

ghost commented 2 years ago

for that just a replace like with the videos whatever_lab_file_name_is_goes_here = whatever_lab_file_name_is_goes_here.replace(':', '')


can add these functions and use these for bad characters in file names and folder names

def fix_string_filename(string):
    forbidden = ["?", "|", ":", "<", ">", "\"", "*", "/"]
    for char in forbidden:
        if char in string:
            string = string.replace(char, "-")
    return string

def fix_string_foldername(string):
    forbidden = ["?", "|", ":", "<", ">", "\"", "*", "/"]
    for char in forbidden:
        if char in string:
            string = string.replace(char, "")
    return string

usage:

lab_filename = fix_string_filename(lab_filename)

subfoldername = fix_string_foldername(subfoldername)

Lomar5115 commented 2 years ago

save_path_wname = os.path.join(subfolder_name, 'index.html') with open(save_path_wname,'w',encoding='utf-8') as fp:

Thaaaaaanks broo Works 1000000% .. Wanna fork the repo with the new code?

ghost commented 2 years ago

nope don't want to work someones work.

Lomar5115 commented 2 years ago

nope don't want to work someones work.

Is there any way to change videos name to be as same as it's in the course?

with Script: 1.vod4375hostandnetworkpenetrationtestingexploitation002 The Original video name in the course: Introduction To Exploitation

Any code can fix it? do I need to grab the course .js file? so that I can rename videos with the same course videos names.

ghost commented 2 years ago

there is a way to fix the names just I'll have to look to see if I remember

if i recall you need to let it download with the truncated filename then rename it using os.move

sometimes the real file name is not in the json so this is why this problem exist.

you would need to see if the real filename is somewhere else in the json


so it should be like this

setup paths to old and new file

then

os.move(currentfilename_withpath.txt, newfilename_withpath.txt)

Lomar5115 commented 2 years ago

Thanks for your response, I'll do my best to fix file names problem or I'll rename it manually :)

Did you see the New lab design? after they have purchased Pentester Academy they've included a walkthrough tab & Video Reveal Solution for some labs. Can you check it please?

there is a way to fix the names just I'll have to look to see if I remember

if i recall you need to let it download with the truncated filename then rename it using os.move

sometimes the real file name is not in the json so this is why this problem exist.

you would need to see if the real filename is somewhere else in the json

so it should be like this

setup paths to old and new file

then

os.move(currentfilename_withpath.txt, newfilename_withpath.txt)

ghost commented 2 years ago

have looked at fixing labs part yet. if you fixed it be nice to see function(s)

also it's os.rename and not os.move

os.rename(currentfilename_withpath.txt, newfilename_withpath.txt)

;D