overwolf / jar-infection-scanner

Scan jar files for known infections
MIT License
115 stars 13 forks source link

Compability with Linux #11

Open FellowEsin opened 1 year ago

FellowEsin commented 1 year ago

Hello! So I want to use this scanner on my Linux Mint 21.1 computer. I tried running the program with Wine, but it gives off this error:

Unhandled Exception:
System.ArgumentException: The requested FontFamily could not be found [GDI+ status: FontFamilyNotFound]
  at System.Drawing.GDIPlus.CheckStatus (System.Drawing.Status status) [0x001ce] in <bfbb50e127a74386baaf6a1ce3e1493f>:0 
  at System.Drawing.FontFamily..ctor (System.Drawing.Text.GenericFontFamilies genericFamily) [0x0004d] in <bfbb50e127a74386baaf6a1ce3e1493f>:0 
  at (wrapper remoting-invoke-with-check) System.Drawing.FontFamily..ctor(System.Drawing.Text.GenericFontFamilies)
  at System.Drawing.FontFamily.get_GenericSansSerif () [0x00000] in <bfbb50e127a74386baaf6a1ce3e1493f>:0 
  at System.Drawing.Font.CreateFont (System.String familyName, System.Single emSize, System.Drawing.FontStyle style, System.Drawing.GraphicsUnit unit, System.Byte charSet, System.Boolean isVertical) [0x00011] in <bfbb50e127a74386baaf6a1ce3e1493f>:0 
  at System.Drawing.Font..ctor (System.String familyName, System.Single emSize, System.Drawing.FontStyle style, System.Drawing.GraphicsUnit unit, System.Byte gdiCharSet, System.Boolean gdiVerticalFont) [0x00011] in <bfbb50e127a74386baaf6a1ce3e1493f>:0 
  at System.Drawing.Font..ctor (System.String familyName, System.Single emSize, System.String systemName) [0x00000] in <bfbb50e127a74386baaf6a1ce3e1493f>:0 
  at (wrapper remoting-invoke-with-check) System.Drawing.Font..ctor(string,single,string)
  at System.Drawing.SystemFonts.get_DefaultFont () [0x00000] in <bfbb50e127a74386baaf6a1ce3e1493f>:0 
  at System.Windows.Forms.Control.get_DefaultFont () [0x0000e] in <5ea26500d4d340168c8a375e356ca0ac>:0 
  at System.Windows.Forms.Control.get_Font () [0x00088] in <5ea26500d4d340168c8a375e356ca0ac>:0 
  at System.Windows.Forms.Control.get_FontHeight () [0x000a9] in <5ea26500d4d340168c8a375e356ca0ac>:0 
  at System.Windows.Forms.TextBoxBase.get_PreferredHeight () [0x00001] in <5ea26500d4d340168c8a375e356ca0ac>:0 
  at System.Windows.Forms.TextBoxBase.get_DefaultSize () [0x00001] in <5ea26500d4d340168c8a375e356ca0ac>:0 
  at System.Windows.Forms.Control..ctor (System.Boolean autoInstallSyncContext) [0x000e3] in <5ea26500d4d340168c8a375e356ca0ac>:0 
  at System.Windows.Forms.Control..ctor () [0x00000] in <5ea26500d4d340168c8a375e356ca0ac>:0 
  at System.Windows.Forms.TextBoxBase..ctor () [0x0003a] in <5ea26500d4d340168c8a375e356ca0ac>:0 
  at System.Windows.Forms.TextBox..ctor () [0x0004a] in <5ea26500d4d340168c8a375e356ca0ac>:0 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.TextBox..ctor()
  at JarInfectionScanner.Form1.InitializeComponent () [0x00016] in <30c8316a67b642a994f453a2ba918268>:0 
  at JarInfectionScanner.Form1..ctor () [0x00006] in <30c8316a67b642a994f453a2ba918268>:0 
  at (wrapper remoting-invoke-with-check) JarInfectionScanner.Form1..ctor()
  at JarInfectionScanner.Program.Main () [0x0000b] in <30c8316a67b642a994f453a2ba918268>:0 
[ERROR] FATAL UNHANDLED EXCEPTION: System.ArgumentException: The requested FontFamily could not be found [GDI+ status: FontFamilyNotFound]
  at System.Drawing.GDIPlus.CheckStatus (System.Drawing.Status status) [0x001ce] in <bfbb50e127a74386baaf6a1ce3e1493f>:0 
  at System.Drawing.FontFamily..ctor (System.Drawing.Text.GenericFontFamilies genericFamily) [0x0004d] in <bfbb50e127a74386baaf6a1ce3e1493f>:0 
  at (wrapper remoting-invoke-with-check) System.Drawing.FontFamily..ctor(System.Drawing.Text.GenericFontFamilies)
  at System.Drawing.FontFamily.get_GenericSansSerif () [0x00000] in <bfbb50e127a74386baaf6a1ce3e1493f>:0 
  at System.Drawing.Font.CreateFont (System.String familyName, System.Single emSize, System.Drawing.FontStyle style, System.Drawing.GraphicsUnit unit, System.Byte charSet, System.Boolean isVertical) [0x00011] in <bfbb50e127a74386baaf6a1ce3e1493f>:0 
  at System.Drawing.Font..ctor (System.String familyName, System.Single emSize, System.Drawing.FontStyle style, System.Drawing.GraphicsUnit unit, System.Byte gdiCharSet, System.Boolean gdiVerticalFont) [0x00011] in <bfbb50e127a74386baaf6a1ce3e1493f>:0 
  at System.Drawing.Font..ctor (System.String familyName, System.Single emSize, System.String systemName) [0x00000] in <bfbb50e127a74386baaf6a1ce3e1493f>:0 
  at (wrapper remoting-invoke-with-check) System.Drawing.Font..ctor(string,single,string)
  at System.Drawing.SystemFonts.get_DefaultFont () [0x00000] in <bfbb50e127a74386baaf6a1ce3e1493f>:0 
  at System.Windows.Forms.Control.get_DefaultFont () [0x0000e] in <5ea26500d4d340168c8a375e356ca0ac>:0 
  at System.Windows.Forms.Control.get_Font () [0x00088] in <5ea26500d4d340168c8a375e356ca0ac>:0 
  at System.Windows.Forms.Control.get_FontHeight () [0x000a9] in <5ea26500d4d340168c8a375e356ca0ac>:0 
  at System.Windows.Forms.TextBoxBase.get_PreferredHeight () [0x00001] in <5ea26500d4d340168c8a375e356ca0ac>:0 
  at System.Windows.Forms.TextBoxBase.get_DefaultSize () [0x00001] in <5ea26500d4d340168c8a375e356ca0ac>:0 
  at System.Windows.Forms.Control..ctor (System.Boolean autoInstallSyncContext) [0x000e3] in <5ea26500d4d340168c8a375e356ca0ac>:0 
  at System.Windows.Forms.Control..ctor () [0x00000] in <5ea26500d4d340168c8a375e356ca0ac>:0 
  at System.Windows.Forms.TextBoxBase..ctor () [0x0003a] in <5ea26500d4d340168c8a375e356ca0ac>:0 
  at System.Windows.Forms.TextBox..ctor () [0x0004a] in <5ea26500d4d340168c8a375e356ca0ac>:0 
  at (wrapper remoting-invoke-with-check) System.Windows.Forms.TextBox..ctor()
  at JarInfectionScanner.Form1.InitializeComponent () [0x00016] in <30c8316a67b642a994f453a2ba918268>:0 
  at JarInfectionScanner.Form1..ctor () [0x00006] in <30c8316a67b642a994f453a2ba918268>:0 
  at (wrapper remoting-invoke-with-check) JarInfectionScanner.Form1..ctor()

Can you do something about it? Or perhaps there's a problem on my side? Thanks.

Vetpetmon commented 1 year ago

Would be best if we had a native linux version of this detector, for now, if you're a mod dev on Linux, hold off until the app is made into a linux binary, or have a windows user in your dev team run the checker for you.

Waoweens commented 1 year ago

I was able to run it with Mono mono JarInfectionScanner.exe

EDIT: actually, mono crashes when you click browse, but i was able to run it via wine, your error message says you are missing fonts, try installing fonts with winetricks

image

ivanpu commented 1 year ago

I couldn't make it run on my computer, so I've converted the check to Python: https://gist.github.com/ivanpu/c5347bf107fa900ac79f1fcf2f056e7c

DISCLAIMER: It didn't find any infected jars on my computer, so I can't guarantee that it actually finds stage-0 infection. I assume that my code is correct if the code in this repo is correct.

adventuretc commented 1 year ago

I can run it inside Steam using ProtonGE or Proton (and works, says no files are infected) but not with system wine or mono. I think it needs a new enough version of Wine to have WPF or something like that.

I used ChatGPT to convert linux paths to wine paths. :chefkiss: Or issue winepath --windows /home/xy/.minecraft

Ampflower commented 1 year ago

Does work with Mono it seems, just the browse button doesn't work, but manually typing in the path scans everything fine.

ivanpu commented 1 year ago

Indeed works if not clicking the "Browse" button. But it stops on the first IOExcetption it encounters, instead of skipping that folder :facepalm:

edit: the issue is specifically with root owned ".Trash-0" and "lost+found" folders in the roots of every mounted partitions, and maybe some other special folders I'm not aware of.

KtheVeg commented 1 year ago

I made a scanner that works with Linux if anyone here is interested. It does mostly the same thing, with a UI as well.

I know this is a bit of self-promotion, but the fact that this tool didn't work for linux bothered me so I made it for Linux.

If you wanted to get it you can use this link, but if I shouldn't self-promo here, then lmk and I'll remove this comment.