cprowse
-
Total Posts
:
5
- Scores: 0
-
Reward points
:
0
- Joined: 12/13/2011
- Location: London, UK
-
Status: offline
|
Can you read a text file in a JAR file with VBS?
Tuesday, December 13, 2011 9:18 PM
( permalink)
Hi all - I've used this forum loads, but this is my first post - I can't find the answer anywhere... I'm using an "interesting" enterprise application, and need to check which version of the local client a user is running - unfortunately the only way to do this is to read a file within a jar on the local machine. I've written a script to do this by simply extracting the file I want to a temp folder using "myShell.Run chr(34) & "jar.exe" & chr(34) & " -xf " & chr(34) & "C:\myjar.jar" & chr(34) & " " & "test.txt", 1, True" and checking it, which works fine on my machine... But of course, the client machines don't have java installed. They also don't have any standard unzipping tools available so I can't crack open the JAR. And I'm not allowed to install anything on the machines (we don't manage them, some are desktops, some are laptops). So my question is - can I read a file inside of the JAR using VBScript, without unzipping or extracting the JAR first? Fingers crossed, -Chris
|
|
|
|
ebgreen
-
Total Posts
:
8219
- Scores: 98
-
Reward points
:
0
- Joined: 7/12/2005
-
Status: offline
|
Re:Can you read a text file in a JAR file with VBS?
Wednesday, December 14, 2011 3:10 AM
( permalink)
Why not just copy it from their machine to yours then do what works locally?
|
|
|
|
cprowse
-
Total Posts
:
5
- Scores: 0
-
Reward points
:
0
- Joined: 12/13/2011
- Location: London, UK
-
Status: offline
|
Re:Can you read a text file in a JAR file with VBS?
Wednesday, December 14, 2011 3:18 AM
( permalink)
Good point - this worked for some of the earlier items, but the script I'm putting together now needs to run on the client before they log in (essentially checking they have the right version before giving them a login prompt). Therefore the magic has to happen on their machine :( -Chris
|
|
|
|
ebgreen
-
Total Posts
:
8219
- Scores: 98
-
Reward points
:
0
- Joined: 7/12/2005
-
Status: offline
|
Re:Can you read a text file in a JAR file with VBS?
Wednesday, December 14, 2011 3:43 AM
( permalink)
If they do not have JAVA installed (which begs the question what exactly they are going to do with the JAR), then you are sort of SOL. The JAR file encoding is well known so I suppose that you could write your own code to decode it.
|
|
|
|
cprowse
-
Total Posts
:
5
- Scores: 0
-
Reward points
:
0
- Joined: 12/13/2011
- Location: London, UK
-
Status: offline
|
Re:Can you read a text file in a JAR file with VBS?
Wednesday, December 14, 2011 4:02 AM
( permalink)
The client ships with it's own cut down (but extremely customised, non-standard, horrible and weird) JRE that allows the executable JAR to run - but doesn't allow me to do anything useful. I thought rolling my own might be the answer, but was hoping I'd missed something obvious. Thanks for your quick responses, -Chris
|
|
|
|
ebgreen
-
Total Posts
:
8219
- Scores: 98
-
Reward points
:
0
- Joined: 7/12/2005
-
Status: offline
|
Re:Can you read a text file in a JAR file with VBS?
Wednesday, December 14, 2011 4:06 AM
( permalink)
Snoop around on google first, but I have never run across VBS for decoding JARs before.
|
|
|
|
TNO
-
Total Posts
:
2094
- Scores: 36
-
Reward points
:
0
- Joined: 12/18/2004
- Location: Earth
-
Status: offline
|
Re:Can you read a text file in a JAR file with VBS?
Wednesday, December 14, 2011 5:36 AM
( permalink)
cprowse ... But of course, the client machines don't have java installed. They also don't have any standard unzipping tools available so I can't crack open the JAR. And I'm not allowed to install anything on the machines (we don't manage them, some are desktops, some are laptops). So my question is - can I read a file inside of the JAR using VBScript, without unzipping or extracting the JAR first? Are these machines older than WinXP? If not, then the native unzip command can be used. Otherwise, the only solution I can see is to implement a complete VBScript unzipping solution. I may have something laying around in JScript...
To iterate is human, to recurse divine. -- L. Peter Deutsch
|
|
|
|
ehvbs
-
Total Posts
:
3320
- Scores: 112
-
Reward points
:
0
- Joined: 6/22/2005
- Location: Germany
-
Status: offline
|
Re:Can you read a text file in a JAR file with VBS?
Wednesday, December 14, 2011 6:03 AM
( permalink)
Can't you use an indirect indication for the software's version - size, date, or checksum of the .jar?
|
|
|
|
ebgreen
-
Total Posts
:
8219
- Scores: 98
-
Reward points
:
0
- Joined: 7/12/2005
-
Status: offline
|
Re:Can you read a text file in a JAR file with VBS?
Wednesday, December 14, 2011 6:05 AM
( permalink)
Ooh...if nothing else in the JAR was changing then something like an MD5 would be a great idea Ehvbs.
|
|
|
|
59cobalt
-
Total Posts
:
969
- Scores: 91
-
Reward points
:
0
- Joined: 7/17/2011
-
Status: offline
|
Re:Can you read a text file in a JAR file with VBS?
Wednesday, December 14, 2011 8:57 AM
( permalink)
Something like this won't work? JarFile jarfile = new JarFile("\\PATH\\TO\\foo.jar");
System.out.println(jarfile.getManifest().getMainAttributes().getValue("Manifest-Version"));
|
|
|
|
cprowse
-
Total Posts
:
5
- Scores: 0
-
Reward points
:
0
- Joined: 12/13/2011
- Location: London, UK
-
Status: offline
|
Re:Can you read a text file in a JAR file with VBS?
Wednesday, December 14, 2011 8:34 PM
( permalink)
Thanks all - can't believe I didn't think about the checksum, that will be helpful. Had hoped to do something along the lines of the "get manifest file" in the last post - but not sure how to do it in VBScript?
|
|
|
|
59cobalt
-
Total Posts
:
969
- Scores: 91
-
Reward points
:
0
- Joined: 7/17/2011
-
Status: offline
|
Re:Can you read a text file in a JAR file with VBS?
Sunday, December 18, 2011 5:52 AM
( permalink)
You don't do Java in VBScript. Does the GetManifest() call not work from a Java program?
|
|
|
|
wenbibi
-
Total Posts
:
11
- Scores: 0
-
Reward points
:
0
- Joined: 12/18/2011
-
Status: offline
|
Re:Can you read a text file in a JAR file with VBS?
Sunday, December 18, 2011 4:20 PM
( permalink)
[deleted]
<message edited by TNO on Monday, December 19, 2011 3:29 AM>
|
|
|
|
cprowse
-
Total Posts
:
5
- Scores: 0
-
Reward points
:
0
- Joined: 12/13/2011
- Location: London, UK
-
Status: offline
|
Re:Can you read a text file in a JAR file with VBS?
Sunday, December 18, 2011 8:33 PM
( permalink)
59cobalt You don't do Java in VBScript. Does the GetManifest() call not work from a Java program?
|
|
|
|