Decompiler for PIC - pic

I lost my code that I wrote for my PIC16F18346, so I had to read it from the PIC that I programmed before.
I have read a lot about the non-existence of a PIC decomiler (from assembly to C), but it's all a few years ago.
Does anybody know if one exists?
I know I will need to work afterwards because it's not perfect, but it's a big start.
Thanks.

At present there is no perfect way to get back C code file using generated assembly file.

Related

How to get started posting a question with Stack Overflow?

I know this is going to sound extremely stupid but I honestly cannot figure out how to post a question I have here for a program I am trying to make.
Whenever I paste my code into the code section this website tells me I have not formatted correctly. I triple check everything and it is all perfectly formatted. It is strange though because my code ends up being halfway into the place where I am suppose to describe the issue. So I am definitely doing this wrong.
Would somebody please walk me through a simple tutorial so I can finally ask my questions?
Honor to help you, I think you can first learn how to use markdown.
And this is two useful tutorial I read when I am learning.
Perfect question : WRITING THE PERFECT QUESTION
Use Markdown effectively : Markdown Getting Started
As for the display of code you mention above, you can use triple ``` to surround the code like this
import math
print('hello world')

How can one create a polyglot PDF?

I like reading the PoC||GTFO issues and one thing I found remarkable when I first discovered it, was the "polyglot" nature of their PDF files.
Let met explain: when you consider for example their 8th issue, you may unzip files from it; execute the encryption they are talking about by running it as a script and even better(worse?) with their 9th issue you can even play it as a music file!
I'm currently in the process of writing small scripts every week and writing each time a little one page PDF in LaTeX to explain the said scripts. So I would really enjoy being able to create the same kind of PDF files. Sadly they explained (partly) in their first issue how to include zip files, but they did so through three small sketches of cmd lines without actual explanations.
So my question is basically :
how can one create such a polyglot PDF file containing stuff like a zip as well as being a shell script which may be run using arguments just like normal scripts?
I'm asking here about the process of creation, not just an explanation of how this is possible. The ideal way for me would that there are already some scripts or programs allowing to create easily such PDF files.
I've tried to search the net for the keywords "polyglot files" and others of the kind and wasn't able to find any useful matches. Maybe this process has another name?
I've already read the presentation by Julia Wolf which explains how things works, but I sadly haven't had time to apply the knowledge there to real world, because I'm sadly not used to play with file headers and the way a PDF is constructed.
EDIT:
Okay, I've read more and found the 7th edition of PoC||GTFO to be really informative concerning this subject. I may end up being able to create my own scripts to do such polyglot PDF files if I have some more time to consider it.
I played around with polyglots myself after attending Ange's talks and also talking to him in person. You really need to understand the file formats to be able to nest them into each other.
However, long story short, here are some links I found extremely useful for creating polyglots:
Some older Google Code Trunk
PoC of the polyglot stuff
Especially the second link (to github) will help you creating polyglots, but also understanding how they are working and how they are implemented. Since it is mostly Python stuff and very well / clean written, it is very useful and easy to follow.
I feel dissecting some file formats would be a good place to start. You can find many file format specifications for different file types through Google, but they can be a tough read and will likely take you some time to translate into whatever language you are using.
PDF: https://www.adobe.com/content/dam/acom/en/devnet/pdf/pdfs/PDF32000_2008.pdf
ELF: https://www.cs.cmu.edu/afs/cs/academic/class/15213-s00/doc/elf.pdf
ZIP: http://kat.sdf.org/zip_file_format.txt
The language(s) you select will need a way to read and write raw bytes (not just ascii alphanumeric), so perhaps C would be good for more direct access to memory. Some Python tricks could help with open sourcing the scripts easily.
To dissect the files, you may want to build a tool kinda like https://github.com/kvesel/zipbrk/ to take them apart, then put them all back together in a polyglot format. For example, zip does not require the section headers to be at the start (or even contiguous for that matter), and PDF magic number can appear in multiple places within the file as well. I also believe I recall a polyglot tool being included in one of the PoC||GTFO publishings (maybe issue 8 or 2??) as a polyglot in the pdf file.
Don't forget the hackers bible! :)
https://nostarch.com/gtfo

How to edit the original string column in poedit?

Hi I am using poedit editor and i am not able to edit the original string column. I want to edit few words on original string column. Thanks in Advance
(Oh well, I'll answer it here as well, for the benefit of the people who may find this post. But you won't like the answer any more than when I replied to you yesterday, when you asked on the Poedit mailing and in personal email to me.)
Short answer is: you can't. Read the introductory sections of the GNU gettext manual -- it explains the basic concepts of gettext translations very well, from both the programmer's and translator's perspectives, and it's clear you don't understand the concept of gettext.
Really, I mean it: please, please, read at the lest the intro part of the manual. The fine folks from the GNU gettext project put a lot of effort into it and if you've spent 5-10 minutes with it, you wouldn't need to ask this question.
Longer version:
Gettext uses text strings (typically in English) in the source code as translation keys. And it has tools to extract the strings and put them into a PO file. This ensures that only strings that are actually used are translated.
Changing the original string (called msgid -- it really is an ID) makes no sense. You would then have a translation of a string that is never used in the source code and so the translation would be guaranteed to never be used. Way to waste the translator's time, wouldn't it?
Want to "edit a few words"? Edit them in the source code. That's the only way that can ever work with gettext.
What Vaclav is saying is very true. If you change the actual source string, the system won't read it.
In Poedit, simply select the string from the long list that you want to edit then you will see that string in the Source Text at the bottom of the screen. Then in the Translation box, enter your preferred wording. Don't forget to include any variable aswell otherwise your change won't work.
What Vaclav is saying is very false.
You can change it. Open the file with notepad. Ctrl + F the original text that you want to change. Change it, and then save it. Then open the file with po edit again, and you will see the changed text.

Generating table of contents

I posted this one a couple of months ago on the Mathematica newsgroup, but got no usable response. I thought I'd give SO a try.
The question was: I don't seem to be able to find the method to generate the table of contents of a
Mathematica document I'm working on. Anyone knows this feauture's
hideout?
David Annetts pointed me in the direction of the AuthorTools, an old v5.1
utility package that's still hidden in Mathematica. However, it
doesn't work on my document (v7). Any clue?
Edit
The TOC should contain correct section numbers (if present in the stylesheet) and list page numbers (this requires taking page size settings into account).
Perhaps looking at the code of Yuri Kandrashkin's package, Sidebar, will be useful?

Way to compare two barcodes

I have two barcodes that I am working with. They are clearly different, but both scan as code 128. One is weird and one is normal. I have tried to reprint the data for the barcode in every way I can think of to I can see what subset (A, B or C) is being used.
For the normal one I know it is A for the first 10 chars then it changes the encoding to B.
I cannot seem to find out how to see what the encoding is on the other (weird) one.
I am using a symbol scanner. (I turned on the prefix char but that only told me D (Code 128)
Is there any tool to allow me to dig into the barcode symbologies?
I know very little about barcodes and zero about non-european ones, but for weird implementations of Code 128, there is also GS1-128.
This online barcode generator looks quite nice and can generate a lot of formats you might want to check against.
Chiming in late here, but the ZXing library (I'm a developer) reads Code 128. You could have it scan the barcode while you attach a debugger to the code. It would show you exactly what's happening, step by step, in the decoding, including subset changes.
I know the problem is fixed. But here's some more resource in case someone's in need :)
Like Pekka mentioned, a Code 128 have subsets like Code 128A, Code 128B, Code 128C and GS1-128(UCC/EAN-128). Here is more information on Code 128 barcode, with encoding pattern illustration.
Thanks for those that answered and commented.
Turns out the company that made our barcodes had a printing error. That caused the barcode to look different.
How it ever successfully decoded I do not know. Anyway. I am going to award the question to Pekka because he gave me a workable solution.

Resources