调用了楼主的js代码,用在船舶轨迹加密数据上测试,结果报错,想请问这种情况要怎么解决?非常感谢!
python 代码:
`data = 'AABHAQAA8MERYzKJDQdmOHIBfRJOSABL/3//AErCEWOZhg0HpilyARcTekm0Rv9//wDIvxJjo+8JB8QtaQGpDGBPTE//f/8Ak8ESY/reCQc8/WgBdw0wTfRM/3//AE6EFWOM0A8H50RrAToFDgbcBf9//wAnSBdj0JsNB/zVbwHeDfyFbIT/f/8ANUkXY0qFDQfZ8W8Bqg2qgrCB/3//AEJKF2Mtcw0HMQ9wAREOuoG8f/9//wAySxdjFmANB0AocAGoC6KA3IL/f/8AqUsXY6pXDQfzNHABqw5mhTSF/3//AFpOF2PFGQ0HzXdwAXgO9H70fv9//wBZUBdj6fEMB9WscAFDDep+QIP/f/8AT1EXY3TfDAdfx3ABRQ6ufsh9/3//AH9SF2PZzAwHgedwARQQsHecfP9//wDZUhdjVcQMB2TwcAFDDZ56RHr/f/8AvlQXY5uSDAcqH3EBRg/kdeB5/3//AKtVF2PvfAwHeDZxAUMNoH3sd/9//wCRVxdjdF0MBydccQE+CfRqjG7/f/8AvVgXYzNIDAepX3EBoAUachBy/3//AJFZF2OnOAwHJGJxATwHcmUsZf9//wAXWxdjlRgMB4BkcQE9CCRt/Gz/f/8ArVsXYwIODAdQYnEBcgnwUNxQ/3//ACRcF2PGBgwHF1pxAdgIimFEYf9//wDYXBdjZPcLB5RTcQGkCOpq0Gv/f/8AyV0XY6XjCwfpU3EBCghSZyBn/3//AE1hF2P6ygsHHXdxAaUJloLUe/9//wBHZBdjJqwLB2izcQF8ETZ5GHn/f/8AEGUXY1+aCwffyHEBqg2Uf1h//3//ADxmF2MbggsHX+lxAeAPFoC8f/9//wAXZxdjpm8LB+kAcgF5DzZ+LH7/f/8AhmcXY/5nCwfFDXIBdw2EgISA/3//AOBnF2MfYAsHzBdyAeAPqHqoev9//wBnaRdj00ULB5NEcgFFDq6DpIP/f/8AwGkXY8w9CwdwTnIBdw0WgLx//3//APxpF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//wAmKxpjhcD7Bn1RYAHUBSRP6E7/f/8AriwaY/6x+wZfQWABOgWcWXRZ/3//AAgtGmNXrvsGnz1gAdQFJFlAUf9//wD0LRpji6T7Bsw0YAHUBU5XVFb/f/8AIS8aY8qX+wavKWABOwZGX+xe/3//AGwwGmOPivsGRx1gAQkHvFw8Wv9//wBSMhpjf3f7BjUKYAHVBnJbaFv/f/8A3jMaY11m+wZc/F8BbQVoW4BX/3//AH81GmNEUvsG7u9fAQkHbFe4Vv9//wBQNhpjZ0j7BqPpXwGgBf5gDGL/f/8AXTcaY1s7+wa14V8BbASQW2hb/3//AKo6GmNcFfsGecZfATsGVFFAUf9//wC+OxpjLgn7Bl+9XwHUBZZamFP/f/8ArjwaY8b++gaNtV8BnwSaWxxX/3//AL09GmP58voG9axfAToFsF4QWf9//wCSQBpjgNH6BkyXXwGfBBpetF//f/8A/UEaY+DA+gY/jV8BoAWyXJRc/3//ANNCGmP5tvoGRYdfAQcGzGB8YP9//wDoQxpjO6r6Bv9/XwHTBGRf2Fn/f/8A30gaY4l6+gYIVl8BPgnWW8xb/3//AP5KGmOYWvoGzUVfAQYF3mLUYv9//wAqThpj0zf6BqApXwE7BhRVxFT/f/8A/lAaY/sZ+gZrEV8BbASsU9hZ/3//AL9ZGmPWxvkGfspeAWsD+FKsWP9//wBRZBpjnWr5Bj15XgGfBGZYgFf/f/8AnGYaY91X+QblaF4BBgXOWQRb/3//AD1oGmNZSvkGYlxeAToFIlYcV/9//wCDahpjYTj5BopLXgE4BFJY5Ff/f/8ApmwaY20m+QYLPV4BOATeWMxb/3//AMVuGmOQF/kGvCxeAdEDxlJAUf9//wBPcBpjJA75BiYgXgEFBHRZdFn/f/8AgXMaYw/4+AbgE14BbASCczxz/3//ACiPGmNDGfoGVtteAZ8EdBMYFf9//wD2pBpjrcv6BmyDXwFsBLIRJBP/f/8A'
with open(r'D:\Documents\JupyterNotebook\AIS\ShipxySpider-main\encrypt.js', 'r', encoding="utf-8") as f:
content = f.read()
ctx = execjs.compile(content)
result = ctx.call('decrypt',data)
result`
报错信息:
`---------------------------------------------------------------------------
ProgramError Traceback (most recent call last)
~\AppData\Local\Temp/ipykernel_4172/651705732.py in
12 content = f.read()
13 ctx = execjs.compile(content)
---> 14 result = ctx.call('decrypt',data)
15
16 result
~\anaconda3\lib\site-packages\execjs_abstract_runtime_context.py in call(self, name, *args)
35 if not self.is_available():
36 raise execjs.RuntimeUnavailableError
---> 37 return self._call(name, *args)
38
39 @AbstractMethod
~\anaconda3\lib\site-packages\execjs_external_runtime.py in _call(self, identifier, *args)
90 def _call(self, identifier, *args):
91 args = json.dumps(args)
---> 92 return self._eval("{identifier}.apply(this, {args})".format(identifier=identifier, args=args))
93
94 def _exec_with_pipe(self, source):
~\anaconda3\lib\site-packages\execjs_external_runtime.py in eval(self, source)
76
77 code = 'return eval({data})'.format(data=data)
---> 78 return self.exec(code)
79
80 def exec(self, source):
~\anaconda3\lib\site-packages\execjs_abstract_runtime_context.py in exec_(self, source)
16 if not self.is_available():
17 raise execjs.RuntimeUnavailableError
---> 18 return self.exec(source)
19
20 def eval(self, source):
~\anaconda3\lib\site-packages\execjs_external_runtime.py in exec(self, source)
86 else:
87 output = self._exec_with_pipe(source)
---> 88 return self._extract_result(output)
89
90 def _call(self, identifier, *args):
~\anaconda3\lib\site-packages\execjs_external_runtime.py in _extract_result(self, output)
165 return value
166 else:
--> 167 raise ProgramError(value)
168
169
ProgramError: TypeError: 'console' 未定义`