GerbenJavado / LinkFinder

A python script that finds endpoints in JavaScript files
https://gerbenjavado.com/discovering-hidden-content-using-linkfinder
MIT License
3.64k stars 588 forks source link

help me! OSError: [WinError 1] 函数不正确。 #64

Open 0nlyuAarOn opened 5 years ago

0nlyuAarOn commented 5 years ago

我该如何去解救这个报错??

python3 linkfinder.py -i http://www.baidu.com -d -o gcy.html


Running against: https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/static/protocol/https/jquery/jquery-1.10.2.min_65682a2.js

Running against: https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/static/protocol/https/plugins/every_cookie_4644b13.js

Running against: https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/static/protocol/https/plugins/every_cookie_mac_82990d4.js

Running against: https://ss1.bdstatic.com/5eN1bjq8AAUYm2zgoY3K/r/www/cache/static/protocol/https/global/js/all_async_search_f3b9a2f.js

URL to access output: file://D:\LinkFinder-master\gcy.html Output can't be saved in gcy.html due to exception: [WinError 1] 函数不正确。 Traceback (most recent call last): File "linkfinder.py", line 251, in html_save print("URL to access output: file://%s" % os.path.abspath(args.output)) OSError: [WinError 1] 函数不正确。

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "linkfinder.py", line 392, in html_save(output) File "linkfinder.py", line 259, in html_save due to exception: %s" % (args.output, e)) OSError: [WinError 1] 函数不正确。

EdOverflow commented 5 years ago

由于您正在用Windows,而Linkfinder 会加 file://D:\LinkFinder-master\gcy.html前面,这样会令路径不正确。

OVERPEY commented 2 years ago

please write in English how to fix this.

ProgramFilesx86 commented 2 years ago

由于您正在用Windows,而Linkfinder 会加 file://D:\LinkFinder-master\gcy.html前面,这样会令路径不正确。

And how can we then fix it ?

hid3rx commented 2 years ago

I changed the code like this, and it works:

def html_save(html):
    '''
    Save as HTML file and open in the browser
    '''
    # hide = os.dup(1)
    # os.close(1)
    # os.open(os.devnull, os.O_RDWR)
    try:
        s = Template(open('%s/template.html' % sys.path[0], 'r').read())

        text_file = open(args.output, "wb")
        text_file.write(s.substitute(content=html).encode('utf8'))
        text_file.close()

        print("URL to access output: file://%s" % os.path.abspath(args.output))
        file = "file:///%s" % os.path.abspath(args.output)
        if sys.platform == 'linux' or sys.platform == 'linux2':
            subprocess.call(["xdg-open", file])
        else:
            webbrowser.open(file)
    except Exception as e:
        print("Output can't be saved in %s \
            due to exception: %s" % (args.output, e))
    # finally:
    #     os.dup2(hide, 1)
QGB commented 2 years ago
d=ctypes.CDLL("fputs.pyd")
kernel32 = ctypes.WinDLL('kernel32', use_last_error=True)
kernel32.FreeLibrary.argtypes = [ctypes.wintypes.HMODULE]

In [84]: kernel32.FreeLibrary(d._handle)
Out[84]: 1

In [85]: Win.error_code(_)
1
1 - 函数不正确。

kernel32.FreeLibrary OSError WinError 1 函数不正确

HellQqppt commented 1 year ago

hid3rx的代码尝试了,可行,把整体复制进去,旧的代码注释掉就可以了