Terminal program to CSV - terminal

I have a little project at work, but I'm stuck in my tracks at the moment. We have quite a few Motorola MC1000 hand held barcode scanners at work, doing nothing at the moment, and I want to get them working again for stock takes and what not.
Now, these were pre-installed with a program called MCA, which is a simple barcode scanner and quantity program, which I'm not sure where it saves this information (maybe in memory), but I am unable to get the data from just connecting the device via USB.
On the program, there is a section called "send data" which then outputs data via COM1 port. I have managed to intercept the old program we used to read the barcodes (there is no way to export from this old program), so I need something new, where I can export barcode, quantity via CSV.
Using serialmon, I have found that I can read the barcode, plus some extra confirmations? then the quantity, plus more confirmations, then the next barcode.
Now I need to know if there is a program out there already that can connect to the com1 port, and then read/respond to the device to download all the barcodes and quantities and then export this to a csv, or even if a simple command prompt bat file could do this?
After some testing earlier, I know the device needs to receive an ack in some way as it times out without this (I could manually do this by sending %0 on a regular basis).
Thanks in advance.

Related

Ghostscript PDF printing

I would like to make my own "PDF printer" using Ghostscript.
Most of solutions I find on the internet involve a 3rd party like Redmon to redirect the PS printer to the Gs executable.
Is there a way to do the same without a 3rd party (other than Gs) ?
Here is my 2 ideas:
Bypass the printing driver and generate Postscript directly by software (From GDI to postscript, using maybe a custom device context like the Metafile device context exist)
Create programmatically a new local port for each document to convert. Maybe using this technique : https://stackoverflow.com/a/1331777/99276
The first solution would be great, but can't find anything about it.
And I am efraid the second is not efficient at all (and detect when the document is fully printed can be tricky)
Update: I used print apis to print in a temp file (the print is synchronous) and then convert the PS file with Gs
Firstly; note that the Windows printing system has been redesigned in Windows Vista and beyond. While the old system still works in WIndows 7 and 8, I am unsure of exactly how usable it is in Windows 10. In Windows 10 everything goes via XPS, and I think (could be wrong) that PostScript is generated by going via XPS first.
Your first idea doesn't sound plausible to me. How can you have a printer (and allow your application to print to it) if you don't have a printer driver ? Even if you could do so, why would you create PostScript from GDI just to send it to Ghostscript and have it create PDF ? It would be far more reasonable to create PDF directly.
In the second case I don't see how adding a new local port would help you at all. Ports are simply where the output of the printer driver is directed. What a Port Monitor (RedMon is a Port Monitor) does is redirect the data stream sent to the port, and 'do something' with it. In the case of Ghostscript + RedMon the 'something' is create a PDF file.
I'm unclear why you don't want to use RedMon, given that you are apparently happy with using Ghostscript. However, if you really don't want to do that then write your own Port Monitor. The process is documented in the Windows Device Driver Development Kit and isn't especially hard. If you get stuck you can even look at the RedMon code as a guide. For example, see here

Silently downloading a .txt file to a macbook's desktop

Basically I need to download a .txt file to my teachers macbook saying something along the lines of "I was here" including my name & student ID.
If I can manage to do this I instantly pass the security class.
For those of you who want to hear (or read) the story, read the following paragraph, for the rest just skip it.
My teacher from my Computer Security class has given everyone a challenge, the one who leaves a txt file saying you were here on his macbook's desktop will instantly pass the class. He usually keeps an eye on his macbook and if you want access to it you'd have to steal it without him seeing you do it. His disk is encrypted and he has long passwords. I have thought about a few approaches and I want to get as much information on each approach as possible. First approach was simply hanging a recorder somewhere in the room to record him typing in his password then stealing his mac and creating the txt file. Second approach was somehow getting him to run a file that would create said txt file. And third approach is basically injecting javascript code into his sites which silently download the txt file to his desktop. Now I just need to know if it's even possible to silently download said file.
So here we finally come to the question, is there a way of silently downloading a txt file, and if so how would one do it?
And if it isn't possible, does anyone have any ideas for me to place the txt file on his pc?
EDIT: For those of you wondering, its uni/college not some kind of preschool.
Well, Have you performed any scans on this particular macbook? Do they host any services, like a web server or other service from this machine? That would be the traditional starting point.
Otherwise, Social Engineering, is probably the best way forward. You could pull off the student version of what happened to Ross Ulbricht. Wait for them to log into the machine. Then get some of your mates to create a significant distraction. Download and execute a quick executable that places your "proof" on the desktop (Or just be a quick typist) Profit.
Alternately:
Create a malicious executable.
Change the icon of executable to look like a word document.
Name Executable "Love Letter" or something juicy.
Place the executable on Flash Drive.
Place 5-10 "Boring" useless, normal files on there too. 2-3 pictures. (Just to get his guard down)
Leave this flash drive on or (Preferably near) his desk.
Wait.
This executable should create the text file on the desktop, pop up a smug message, Take a screenshot, and email both you and him the picture as proof.
The executable should also be designed to no longer work after a certain amount of time.

Debugging stm32f4 via bluetooth

I'm rather unexperienced on the field of microcontrollers, I come from a Java background so the question might seem a bit noob but I didn't find much information on this.
So is it possible to debug an STM32F4 board via bluetooth (using eclipse or some othe IDE)? And if so could you send me some links that might help? We're building a robotic car controlled by a discovery board and debugging using an USB cable is not really an option if we don't want to disassemble the whole stuff every time something goes wrong. Hence this would really come in handy. So any help is appreciated
For doing this you would need to find a "Bluetooth Enabled" Debugger. I have never seen any and not sure whether there exists such thing or not.
I would suggest you one thing:
Assuming you have bluetooth connectivity between your board and your Machine,
Insert Debug strings: Send some strings from your board to your PC via Bluetooth. These strings will give you what's going on in Circuit.
For example, After Initialization, send "Init Completed" and like that. You can see these strings and see what's wrong.
I usually do this for my Wireless Device.
What you're wanting to do is really not practical; you're coming at this from way too high a level and trying to imagine the system as if it were running an operating system from the word go.
When you get the STM32 it as empty shell; you need to program it to do what you need to do and the only [sensible] way to get register-level debugging is to use a JTAG interface.
If, and this is a big if, you get it working reliably, but just want to give some debug information back while it is running, you could write a load of routines within the code to send out debugging messages when it enters certain parts of the program - and send it out over Bluetooth - but this is nothing like what you're used to single stepping through your Java code with Eclipse. If you want to do that kind of thing, you are going to have to put a little connector on that allows you to connect your JTAG or two-wire debugger cable to the processor. Even then, when you do that, you will be completely resetting your program and not simply single stepping through from where it went wrong.
You could insert a monitor program within your program to send out register values, program status etc over Bluetooth, but you still have to write the inital code and the only way to do this with out a ridiculous amount of trail and error is via your JTAG or two-wire interface.
Would this product work? It's a "IOGEAR Bluetooth Serial Adapter, GBC232A" for connecting to a serial port over bluetooth. I'm interested in wireless debugging too because my surface-clone dev computer only has one usb and this seems like it could be convenient over a tangle of usb cords and a usb hub. I have zero experience with any of this, so maybe you could validate or invalidate it as an option. I figure it just needs a proper serial connector wired up on the board and power from on-board?

Writing a virtual printer driver for windows

I am new to windows development and I am trying to write a user-mode windows(XP, Vista & 7) virtual printer driver. My aim is to intercept the output being sent to the hardware printer by a third party app and add some extra data(text + graphics) to that output towards the end of the output. Then send the final payload to be printed by the hardware printer. Note that my data would not be added to every print out from the machine but just from a particular third party app.
I want to add my extra data to the print output before it gets converted to any Page Description Language(PDL). Can I do this? Would I be able to predictably add my extra data at the end of the output with proper formatting? If yes, then what kind of driver would I need to write and at what layer of the architecture ?
Is there a better way to do the same thing then writing a user-mode printer driver?
Finally, is there a sample code, online blog or book which can help me with this ?
I think you'd be better off getting the application to write to a generic Postscript driver and post-processing the resulting Postscript rather than trying to make sense of the data written to a printer driver; there are excellent open-source tools available for manipulating Postscript.
This page describes setting up a driver on Windows that will produce Postscript although you will want to do something else with the Postscript other than sending it to another printer as described there.
I don't think you need a driver. Just use the standard Postscript driver provided with the WDK, adding .PPD and .INF files to name it and specify characteristics, and then put your code in a port monitor. Port monitors are considerably easier to build and maintain than print drivers.

Making a soft copy(file) of everything printed to any printer from a Windows workstation?

I have been looking into the possibility of creating a soft copy(image/EMF file) of everything printed from Windows - for archival purposes. Does anyone know if it is possible to create a hooking DLL that can grab the printed data in such a general way?
A low tech way of solving it might be to install pdf printer driver as the default printer and remove all others and set it up to automatically write all the files to certain directory on the network and then write a tiny app on another computer to monitor that folder for changes and if any new pdfs appear just print them out to a real printer.
Edit: Otherwise there's apparently something called the Print Monitor API. Here's an article that describes using that from VC++ 6 and seems to be pretty much what you want (assuming it's still supported by the OS you use).
Having looked at this problem in more detail the best solution seems to handle it through Spooler notifications in the Win32.

Resources