Code Monkey home page Code Monkey logo

Comments (7)

0Chencc avatar 0Chencc commented on May 23, 2024

贴一下import的库

from ctfcracktools.

Magic-King avatar Magic-King commented on May 23, 2024

#!/usr/bin/env python

-- coding: utf-8 --

'''
{
title: test,
type: crypto,
author: YellowTail,
detail: test,
Dialog: null
}
'''

def test(word):
print("test!")
return word+"\nsuccess test!"

def main(wordin)
return test(wordin)

代码如上
没有import库XD,在自己尝试使用test的时候报错了

from ctfcracktools.

0Chencc avatar 0Chencc commented on May 23, 2024

hello 很抱歉时隔这么久才给你回复
你这段代码我跑了一次,存在这么几个问题
注释里面的各个类别建议别加上逗号,
然后就是你的def main(wordin)没有加上:导致无法调用
还需要注意的是 如果加上\n换行的话,框架只能读取最后一行的返回值。
你可以将返回的值储存到一个string值里面,这样就可以完整显示了

from ctfcracktools.

0Chencc avatar 0Chencc commented on May 23, 2024
#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
{
title:test
type:crypto
author:YellowTail
detail:test
Dialog:
}
'''

def test(word):
    return word+"\nsuccess test!"

def main(wordin):
    return test(wordin)

如果不需要dialog的话不需要写null,而是空出来,这是我修改之后的代码,可以尝试下,可以运行。

from ctfcracktools.

Magic-King avatar Magic-King commented on May 23, 2024

首先对我上次的一些python的基本错误道歉,上次应该是由于自身粗心而导致的语法问题
但是这是还是运行错误了,这是我软件版本问题吗(假如你从上次到现在还没更新的话)?
我用了你的代码贴上去,然后根据你说的把字符串存储到一个str里了,但是仍是运行报错
你给的原来的代码也是报一样的错误
插件代码如下

#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
{
title:test
type:crypto
author:YellowTail
detail:test
Dialog:
}
'''

def test(word):
	s = word+"\nsuccess test!"
    return s

def main(wordin):
    return test(wordin)

以下是cmd报错的代码:

D:\0\Tool\Misc\CTFCrackTool\CTFCrackTools>java -jar CTFCrackToolsKt-3.2.3.jar
java.lang.IllegalArgumentException: Cannot create PyString with non-byte value
        at org.python.core.PyString.<init>(PyString.java:64)
        at org.python.core.PyString.<init>(PyString.java:70)
        at org.python.core.Py.newString(Py.java:643)
        at org.python.core.Py.fromIOException(Py.java:237)
        at org.python.core.Py.IOError(Py.java:212)
        at org.python.core.__builtin__.execfile_flags(__builtin__.java:522)
        at org.python.util.PythonInterpreter.execfile(PythonInterpreter.java:286)
        at Core$buildPluginMenuItem$1.actionPerformed(Core.kt:847)
        at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
        at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
        at javax.swing.AbstractButton.doClick(Unknown Source)
        at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
        at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
        at java.awt.Component.processMouseEvent(Unknown Source)
        at javax.swing.JComponent.processMouseEvent(Unknown Source)
        at java.awt.Component.processEvent(Unknown Source)
        at java.awt.Container.processEvent(Unknown Source)
        at java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Window.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
        at java.awt.EventQueue.access$500(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.awt.EventQueue$4.run(Unknown Source)
        at java.awt.EventQueue$4.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)
kotlin.TypeCastException: null cannot be cast to non-null type org.python.core.PyFunction
        at Core$buildPluginMenuItem$1.actionPerformed(Core.kt:890)
        at javax.swing.AbstractButton.fireActionPerformed(Unknown Source)
        at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source)
        at javax.swing.DefaultButtonModel.setPressed(Unknown Source)
        at javax.swing.AbstractButton.doClick(Unknown Source)
        at javax.swing.plaf.basic.BasicMenuItemUI.doClick(Unknown Source)
        at javax.swing.plaf.basic.BasicMenuItemUI$Handler.mouseReleased(Unknown Source)
        at java.awt.Component.processMouseEvent(Unknown Source)
        at javax.swing.JComponent.processMouseEvent(Unknown Source)
        at java.awt.Component.processEvent(Unknown Source)
        at java.awt.Container.processEvent(Unknown Source)
        at java.awt.Component.dispatchEventImpl(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source)
        at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source)
        at java.awt.Container.dispatchEventImpl(Unknown Source)
        at java.awt.Window.dispatchEventImpl(Unknown Source)
        at java.awt.Component.dispatchEvent(Unknown Source)
        at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
        at java.awt.EventQueue.access$500(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.awt.EventQueue$3.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.awt.EventQueue$4.run(Unknown Source)
        at java.awt.EventQueue$4.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source)
        at java.awt.EventQueue.dispatchEvent(Unknown Source)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
        at java.awt.EventDispatchThread.run(Unknown Source)

from ctfcracktools.

0Chencc avatar 0Chencc commented on May 23, 2024

把原来储存在配置文件里的插件删了,重新添加一下。就可以解决了

from ctfcracktools.

Magic-King avatar Magic-King commented on May 23, 2024

十分感谢

from ctfcracktools.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.