"I can't find a problem, maybe I need to obfuscate a larger batch file."
No need. don't waste yout time with a bigger file. I tested last night on a very simple test batch file and the issue is there as well.
I'll put it here shortly and then digest the rest of what you have posted, thank you.
+ Reply to Thread
Results 31 to 48 of 48
-
-
The following is un-obfuscated. The screen font is ok before the 1st. "pause" and changes after that, in the obfuscated version below..
@echo off
echo This is a test ...
pause
"powershell.exe" (Get-CimInstance -ClassName Win32_VideoController -Property VideoModeDescription).VideoModeDescription >temp1.txt
for /f "tokens=1-2 delims=^x^ " %%a in (temp1.txt) do set width=%%a&set height=%%b
echo Width=%width%
echo Height=%height%
del /q temp1.txt
pause
This is the same batch file obfuscated ... Removed, see next post.Last edited by JN-; 23rd Oct 2022 at 15:34.
-
Hi Jack. I realise that copying and pasting the above obfuscated version into a batch file doesn't work. I'm relativity new here, how do I make files available. Do I just give a dropbox link to say a zip file ? or is it the "my files" option.
I have put test 3.bat in "my files". It's the obfuscated version. If you cannot get it then I can make available via dropbox.Last edited by JN-; 23rd Oct 2022 at 15:38.
-
"C:\Windows\System32\cmd.exe"
"C:\Windows\SysWOW64\cmd.exe"
"C:\Windows\WinSxS\amd64_microsoft-windows-commandprompt_31bf3856ad364e35_10.0.19041.746_none _69061189792bce34\cmd.exe"
"C:\Windows\WinSxS\wow64_microsoft-windows-commandprompt_31bf3856ad364e35_10.0.19041.746_none _735abbdbad8c902f\cmd.exe"
I am using Win 10 Pro 21H2 build 19044.2130
If I run the above, does it do something automatically, or just present me with option to set options. -
Ok, I took a chance and put the 4 cmd lines into a batch file and tried to run it. First up it said I cannot run this app on this machine etc.
I then elected to run as Admin. No warning this time, but nothing, nada.
Slip-up. I had it open in Notepad ++ but hadn't saved. So at that stage I was trying to run an empty batch file, sorry.
So when I ran a batch file with the above cmd items it just landed me in the same folder that I ran it from, what exactly was supposed to happen, the cmd font size etc is still as was, Consolos 18, which on my 17" FHD laptop screen is ok.Last edited by JN-; 23rd Oct 2022 at 16:03.
-
I've added "OBFUSCATION.zip" file to "My files".
To make it easy to use and kind of automated I created 2 extra files. # OBF.bat and # Restore.bat.
Usage: simply drag and drop the un-obfuscated file onto # OBF.bat. Thats it, done.
A "Backup" folder is automatically created, the original un-obfuscated file is copied there.
If you want to restore back to the original, over-writing the obfuscated file, then drag and drop the obfuscated file onto the # Restore.bat util. This will delete the file in "Backup" and overwrites the obfuscated file with the original non-obfuscated version. -
I have used exiftool in one of my utils, get Metadata, i’m not aware of how it can be used to reset to the desired cmd windows menu. Do you know if that is the case that it can be used to reset, or are you just throwing it out there ?
just throwing it out there
I have put test 3.bat in "my files". It's the obfuscated version. If you cannot get it then I can make available via dropbox.
I've added "OBFUSCATION.zip" file to "My files".
Have no access to "My files". Kindly consider making available via dropbox.
I am kind of lost with respect to the font change (name and size). You mentioned that these changes are visible via properties.
I was wondering if they are also displayable via exiftoool obfuscated.exe.
If this font data is stored within the metadata of the .exe file then there is a strong possibility that you can change them (the metadata) via a batch file. -
Ok, I missed post #26.
Looks like this code has to studied.
My understanding is that you do something like ...
ObfuscateBatch /m abc_un_obfuscated.cmd and you get a new file, abc_obfuscated.cmd.
My question is , where is the font change? Are you saying that the output file abc_obfuscated.cmd has a font change?
Lost and trying to understand.Last edited by jack_666; 23rd Oct 2022 at 17:34.
-
Here is a Dropbox link to the Obfuscation files ...
https://www.dropbox.com/sh/xp7con0f7skoawh/AABQKGuLo3PxFKMJQuHY_0TQa?dl=0
So "My files" are not for other users to access I guess.
"My understanding is that you do something like ..."
My post 36 explains how to use the OBFUSCATION.zip contents, just drag and drop the un-obfuscated batch file onto # OBF.bat, thats it.
"My question is , where is the font change? Are you saying that the output file abc_obfuscated.cmd has a font change?"
Yes, I left a "Test 2.bat" un-obfuscated file in the zip. When you have unzipped the contents to any folder of your choice, drag and drop the test 2.bat file onto # OBF.bat.
Then run, double click the now obfuscated Test 2.bat file.
Theres a pause initially before the PS part, so the cmd window still is ok, Consolos at 18. Press any key and it passes through the PS code and pauses again, the CMD window style and font are now changed. The on screen difference should be now visible. Before and after the "pause" fonts can be checked also by clicking the top left corner of the cmd window and then check the "Properties"Last edited by JN-; 23rd Oct 2022 at 17:56.
-
JN-
So when I ran a batch file with the above cmd items it just landed me in the same folder that I ran it from, what exactly was supposed to happen, the cmd font size etc is still as was, Consolos 18, which on my 17" FHD laptop screen is ok.
I then do as you have said with regard to changing the properties.
I created a batch file from your obfuscated file post. (Copy/Paste) It worked. No font changes at all. I'm lost.
Try running the batch file from a cmd prompt, AFTER changing the properties of the cmd window to match what I use. Lucida Console, Size 16.
Take the obfuscated batch file, on a flash drive, over to a friend's place and annoy them.Try running it there.
It's all interesting. Maybe another VideoHelp member will follow this thread and give it a try. I'd be interested to know what the result is.
Cheers. -
OK!!
I did what I told you to do.
Try running the batch file from a cmd prompt, AFTER changing the properties of the cmd window to match what I use. Lucida Console, Size 16. -
Your problem lies with the introduction of the environmental variable chcp
Run the below code to replicate the problem
Code:@echo off ::This chcp variable is the source of the font attribute changes chcp 708 echo This is a test ... pause "powershell.exe" (Get-CimInstance -ClassName Win32_VideoController -Property VideoModeDescription).VideoModeDescription >temp1.txt for /f "tokens=1-2 delims=^x^ " %%a in (temp1.txt) do set width=%%a&set height=%%b echo Width=%width% echo Height=%height% del /q temp1.txt pause
-
Well done Jack.
AFAIK he needs this code page change to implement the Obfuscation. It's built in and cannot be changed ?
From his batch file ...
:: When the obfuscated code is run, the current code page is stored, and the
:: code executes within a child cmd.exe process using code page 708. Any
:: command line arguments are passed without changes as long as all poison
:: characters are quoted. The use of escaped poison characters on the command
:: line is complicated and therefore discouraged.
::
:: Upon termination, the code page is restored to the original value and the
:: original environment is restored.
::
:: The use of code page 708 is somewhat arbitrary, except it is critical that
:: there not exist any extended ASCII character pairs that are recognized by
:: cmd.exe as upper/lower case pairs. Code page 708 happens to be the first
:: encoding I tested that passes this test.Last edited by JN-; 24th Oct 2022 at 15:21.
-
AFAIK he needs this code page change to implement the Obfuscation. It's built in and cannot be changed ?
You try, maybe you get a lucky number to use -
Well Jack, thats good enough for me. If I tried one that didn’t cause the font change I would never know if there wasn’t going to be some unintended consequences in the author’s code. Well done, at least I now know that the combination of using PS and chcp causes the problem.
Without PS usage there is no problem. -
Found this …
https://superuser.com/questions/706562/why-does-running-powershell-change-my-console-font
Going for a walk, I’ll look into it sometime later. -
Well looking at all of this … https://superuser.com/questions/538607/cannot-change-powershell-default-font-to-lucida-console its more of a Windows issue.
I’m beginning to lose the will to live, serious rabbit hole. Live with it.
Similar Threads
-
batch that verify if all the video files parsed have the same resolution
By marcorocchini in forum Newbie / General discussionsReplies: 7Last Post: 20th Oct 2022, 18:17 -
Batch edit SSA subs style whilst also resampling resolution
By randombuddy in forum SubtitleReplies: 2Last Post: 22nd Mar 2021, 14:52 -
PotPlayer copy either current subtitle timestamps OR current audio clip
By Sakusuke in forum Software PlayingReplies: 0Last Post: 29th Aug 2020, 12:35 -
MeGui - How to get path/name of current file in the queue dynamically ?
By untymage in forum Video ConversionReplies: 5Last Post: 16th May 2020, 08:51 -
Current PAL/NTSC DVD Conversion Guide? Current Guides are outdated
By isj209h23h in forum User guidesReplies: 3Last Post: 20th Jul 2018, 21:53