Reading PGP key information - public-key

can someone show a description of the information of what a pgp looks like if only the descriptions were there but not the actual information? something like (i dont remember if the values are correct):
packet-type[4 bits],
total length in bytes[16 bits],
packet version type [4 bits],
creation-time[32 bits],
encryption-algorithm[8 bits], ...,etc,etc
ive tried to understand rfc4880, but its tedious and confusing. so far, i am think i have extracted the 4 i wrote above, but i cant seem to get the rest of the information out.
can anyone help? i know i can just find some pgp program, but the whole point of this is to allow me to learn how those programs work in the first place

Read carefully section 4.2 of RFC 4880, there different packet formats, with different packet length encodings.

Related

EMV card & APDU command to get the track 2

I trying to get the PAN from my card. I read a lot of topic about that, but I still understand :'(
I understand I have to find the AID I tried :
00A404000E315041592E5359532E4444463031
Thats works, but I don't really get some interesting informations ... If I correctly understand I have to find the 94 Application File Locator (AFL) (16 Byte) to be able to read the data...
Do i have to try another AID until I find the AFL ?
Thanks
Track2(tag 57) is usually returned in in response to READ RECORDs. To issue READ RECORDs you need to get the AFL first. AFL is returned in response to GET PO.
In VISA contactless you will get track in GET PO itself and you will get AFL only if ODA is required.

Config File Checksum guessing (CRC)

I'm currently "hacking" an old 3d Printer, built in 1996. There is Software running on an old Windows PC. I need to modify some parameters which are not accessible from the front end, so I wanted to modify the config files. But if I modify something, it could not be read anymore. I noticed, that there is a checksum at the end of the file, and I'm not really an checksum expert. I assume that, while loading the file, this checksum is calculated again and compared to the one at the end.
I'm having trouble finding out which checksum algorithm is used.
What I already found out: I think it's not just an addition of the bits in the file. When I'm switching two characters, an checksum, that is generated with addition, would not change. But the software won't take that file.
I'm guessing its some kind of CRC16, because a checksum looks like that:
0x4f20
As I have calculated that number with several usual CRC16 parameters and could not find a match with the "4f20", I assume that it must be an custom CRC16..
Here is a complete sample file:
PACKET noname
style 502
last_modified 1511855084 # Tue Nov 28 08:44:44 2017
STRUCTURE MACHINE_OVRL
PARAM distance_units
Value = "millimeters"
ENDPARAM
PARAM language
Value = "English"
ENDPARAM
ENDSTRUCTURE
ENDPACKET
checksum 0x4f20
I think either the checksum itself or the complete line "checksum 0x4f20" is not being considered while calculated, because thats not possible (?)
Any help is appreciated.
Edit: I got some more files with checksums of course, but these are a lot longer than this file. If needed, I could provide them too..
RevEng was written for this purpose. Given several examples of the input and the associated CRCs, RevEng will derive the CRC parameters. If it is a CRC.

How do I use the modulo operators in Socrata SoQL?

https://dev.socrata.com/docs/datatypes/number.html#, says that % and ^ can be used to get the modulo of one number divided by another number. I cannot get them to work and cannot find examples.
When I try ^ I appear to get exponentiation. Example:
http://data.cityofchicago.org/resource/pubx-yq2d.json?$select=streetnumberto,streetnumberfrom,(streetnumberto-streetnumberfrom)^100%20as%20address_length_in_blocks
When I try % itself, I get a "malformed" error, not so surprisingly. When I try the %25 code for %, I still get a "malformed" error but one that seems to suggest that it correctly inserted the % but does not know what it means. (I am restricted from posting more than two links but just replace the ^ above with % and %25.)
Can anyone help me get this working?
By the way, at the risk of mixing topics, I would ideally like to use an int or round sort of function but they do not seem to exist in SoQL so I was trying to back into getting the integer portion of dividing by 100.
Thank you.
Great question. I just tried it myself and I'm getting a malformed exception too, and it's definitely getting through to the query optimizer:
https://data.cityofchicago.org/resource/erhc-fkv9.json?totalfees=4160%20%25%2010.0
Note I'm using the SODA 2.1 version of that API, which I recommend you migrate to:
https://dev.socrata.com/foundry/#/data.cityofchicago.org/erhc-fkv9
I'll check with our engineering team and see what might be going on. I'll pass on the feature request for round, ceil, floor, etc as well.

Reverse Engineering a CRC Packet

I'm new to reversing.
I need to analyse a packet which i think is checked by CRC.
The packet is the following:
1B1B1B1B0101010176058C0D1FAA62006200726500000101760101074553595133420B0901455359110393AC9601016317D00076058C0D1FAB6200620072650000070177010B0901455359110393AC9601726201650000CC5B7A77078181C78203FF01010101044553590177070100000000FF010101010F31455359313136303030393632320177070100010800FF0101621E52FC690000000001B466C00177070100020800FF0101621E52FC69000000000200B2000177070100010801FF0101621E520165000000950177070100010802FF0101621E520165000000890177070100020801FF0101621E520165000000CE0177070100020802FF0101621E520165000000820177070100010700FF0101621B52FE55000000000177070100600505FF01010101630100010101639EEC0076058C0D1FAC62006200726500000201710163CA5200001B1B1B1B1A011BFC
From what I figured out until now, The first part of this hex-string which contains the frame information and ethernet information is: 1B1B1B1B0101010176058C0D1
After that, it's all data that have been CRC'd.
is there any way I can reverse the CRC and read the Data????? How can i know what base is it?(16/32/64)
(I have more packets like this one)
Thanks for the answers..!
A cyclic redundancy check (CRC) is a one way hash of input data. As it is a hash, and not an encryption nor encoding, there is no means to determine the original data, as there will be multiple valid inputs that give the same result.
CRC's are used by appending them to the data. The original data is still there unaltered, so you can already "read the Data".
As for determining what CRC is used, you can use RevEng, but you will need to try guesses with different CRC locations and sizes, and you will need to use several examples of data.

Tesseract-Job: how to parse an image in order to get the information out of it

good moring.
first of all. This is the most impressive community i ever saw!
Well several days i mused about the three-folded job of
a. getting
b. parsing
c. storing a number of pages.
Two days ago i thought that getting the pages would be the major-task. No this isnt the case - i guess that the parser-job would be a heroic task. Each of the pages that are intended to be parsed is a png-image.
So the question is - after getting all them. How to parse them!? This seems to be the issue. Guess that there are some perl-modules out there - that can help in doing this...
Well - i think that this job only can be done with some OCR embedded! Question: is there a perl-module that can be use here to support this task:
BTW: see the result-pages.
BTW;: and as i thought i can find all 790 resultpages within a certain range between
Id= 0 and Id= 100000 i thought, that i can go the way with a loop:
http://www.foundationfinder.ch/ShowDetails.php?Id=11233&InterfaceLanguage=&Type=Html
http://www.foundationfinder.ch/ShowDetails.php?Id=927&InterfaceLanguage=1&Type=Html
http://www.foundationfinder.ch/ShowDetails.php?Id=949&InterfaceLanguage=1&Type=Html
http://www.foundationfinder.ch/ShowDetails.php?Id=20011&InterfaceLanguage=1&Type=Html
http://www.foundationfinder.ch/ShowDetails.php?Id=10579&InterfaceLanguage=1&Type=Html
i thought i can go the Perl-Way but i am not very very sure:
I was trying to use LWP::UserAgent on the same URLs [see below]
with different query arguments, and i am wondering if LWP::UserAgent provides a
way for us to loop through the query arguments? I am not sure that LWP::UserAgent has a method for us to do that. Well - i sometimes heard that it is easier to use Mechanize. But is it really easier!?
But - to be frank; The first task " GETTING all the pages is not very difficult - if we compare this task with the parsing... How can this be done!?
Any ideas - suggestions -
look forward to hear from you...
zero
You do not need a Perl module, you only need the system function.
system qw[ tesseract.exe foo.png foo.txt ];
my $text = read_file('foo.txt');
You may need to preprocess the images to help Tesseract, say using ImageMagick like:
system qw[ convert.exe -resize 200% image.jpg foo.png ];