确定Java应用程序是否是恶意软件(Determining if a Java app is malware)
我很好奇可以使用哪些自动方法来确定在Windows或PC上运行的Java应用程序是否是恶意软件。 (我甚至不知道这样的应用程序可以使用哪些漏洞。是否有可以了解风险的地方?)如果我有源代码,是否有特定的软件包或类可以比其他软件更有害? 也许他们可能会建议恶意软件?
更新 :感谢您的回复。 我有兴趣知道这是否可行,而且它基本上听起来完全不可行。 很高兴知道。
I am curious about what automatic methods may be used to determine if a Java app running on a Windows or PC is malware. (I don't really even know what exploits are available to such an app. Is there someplace I can learn about the risks?) If I have the source code, are there specific packages or classes that could be used more harmfully than others? Perhaps they could suggest malware?
Update: Thanks for the replies. I was interested in knowing if this would be possible, and it basically sounds totally infeasible. Good to know.
原文:https://stackoverflow.com/questions/5394360
最满意答案
如果要使用1个整数参数定义委托,可以使用
Action<int>
。 例如:Action<int> somethingArgs = (int n) => { n += 1; };
你没有显示
ActionDic
变量是什么,但是如果它是一个IDictionary<string, Action>
你不能使这个工作,因为Action
不接受一个参数。另一方面,你可以做的是使用代表字典:
IDictionary<string, Delegate> ActionDic = ... ActionDic["something"] = (Action)(() => { i += 1; }); ActionDic["somethingArgs"] = (Action<int>)((int n) => { n += 1; });
You could use
Action<int>
if you want to define a delegate with 1 integer argument. For example:Action<int> somethingArgs = (int n) => { n += 1; };
You haven't shown what the
ActionDic
variable is but if it is anIDictionary<string, Action>
you cannot make this work becauseAction
do not accept an argument.What you could do on the other hand is to use a dictionary of delegates:
IDictionary<string, Delegate> ActionDic = ... ActionDic["something"] = (Action)(() => { i += 1; }); ActionDic["somethingArgs"] = (Action<int>)((int n) => { n += 1; });
相关问答
更多-
要传递椭圆,您必须将它们转换为va_list,并在第二个函数中使用该va_list。 特别; void format_string(char *fmt,va_list argptr, char *formatted_string); void debug_print(int dbg_lvl, char *fmt, ...) { char formatted_string[MAX_FMT_SIZE]; va_list argptr; va_start(argptr,fmt); form ...
-
如何创建接受可变数量参数的Java方法?(How to create Java method that accepts variable number of arguments?)[2023-05-02]
你可以写一个方便的方法: public PrintStream print(String format, Object... arguments) { return System.out.format(format, arguments); } 但是,您可以看到,只需重命名format (或printf )即可。 以下是您可以如何使用它: private void printScores(Player... players) { for (int i = 0; i < players.le ... -
如何将可变数量的参数传递给printf / sprintf(How to pass variable number of arguments to printf/sprintf)[2021-12-21]
坏 void Error(const char* format, ...) { char dest[1024 * 16]; va_list argptr; va_start(argptr, format); vsprintf(dest, format, argptr); va_end(argptr); printf(dest); } 这段代码不是那么好 它使用固定大小的字符缓冲区,如果字符串在病理上很长,可能会导致缓冲区溢出错误。 任意大的1024*16大小 ... -
为了实现这一点,首先你需要声明一个委托: delegate int ParamsDelegate(params int[] args); 然后在分配匿名类型对象的方法属性时使用它。 var test = new { Sum = new ParamsDelegate(x => x.Sum()) // x is an array }; 然后你有两种方法调用这个方法: 1) int sum = test.Sum(new [] { 1, 2, 3, 4 }); 2) int sum = test.Sum ...
-
这就是你想要的: #include
#include void console(const char *_sFormat, ...); int main () { console("Hello World!"); return 0; } void console(const char *_sFormat, ...) { va_list ap; va_start(ap, _sFormat); printf("[APP] " ... -
你有两个问题。 其中一个是“如何在我的shell脚本中实现长选项?”,这里有很好的阅读。 另一个问题是,“我如何选择接受任意数量的参数?” 答案主要是“你没有”。 通常最干净的解决方案是让您的脚本多次接受该选项,如: ./myscript -i
-i -i 通过附加到Bash数组,这相对容易处理,如: infiles=() while getopts ":i:o:" opt; do case $opt in i) infiles+=("${O ... -
找到了关于ReflectionClass的这个答案。 这似乎效果最好 foo = $a->newInstanceArgs($args); } # ... } Found this ans ...
-
如果要使用1个整数参数定义委托,可以使用Action
。 例如: Action somethingArgs = (int n) => { n += 1; }; 你没有显示ActionDic变量是什么,但是如果它是一个IDictionary 你不能使这个工作,因为Action不接受一个参数。 另一方面,你可以做的是使用代表字典: IDictionary ActionDic = ... ActionDic["somethin ... -
我试过了,没有收到编译错误。 你看到的实际错误是什么? 这是我使用的代码。 也许我做了不同的事情: public class MultipleArgs { public static void main(String [] args){ run(new Foo("foo1"), new Foo("foo2"), new Foo("foo3")); } public static void run(Foo... foos){ MyFoo[] myFoos = null; if (foo ...
-
您可以使用__VA_ARGS__宏 例如: WriteToLogParamsFunc(const char *__file, int __line, const char* __func, int nLogLevel, const char *szMessage, ...); #define WriteToLogParams(nLogLevel, szMessage, ...) WriteToLogParamsFunc(__FILE__, __LINE__, __FUNCTION__, nLogLevel ...