 want to show in this video how you can create your own SSD Python program with my templates and with an SSD Python module so that I actually want to do is the following so I have SSD to calculate SSD patches for example for calc this is the Windows executable SSD this is SSD hash and what I wanted to do was compare this to another SSD hash now if you look into the help of SSD you can provide file with hashes too much now what is for me a bit cumbersome is first of all that I have to create a file I cannot just provide a hash on the command line and secondly I also have to provide a header in that file with hashes that I provide so I will show you now how you can create your own SSD Python SSD program in in Python with that feature and we are going to use first of all a library an SSD deep library in Python there is an SSD Python library that is a wrapper for SSD but that doesn't work on Python and that's why I'm choosing this one here PP deep which is a pure Python implementation of SSD it's quite simple you import the module and then you can calculate directly at the hash here of a string you can also compare to hashes with this function or you can hash from a file with this function and you just install it with PIP and this is my Python template for binary files a process binary files and that's what we are going to start with so I have that file here I'm going to copy it to SSD PI and then you read my editor so I have process binary file here I'm going to open SSD that I just copied and start to make modifications so first of all SSD in Python that's the description version 1 22nd of May and also adapt the history so I'm starting start from binary template and then I can throw away all those commands here and then here the first thing that I'm going to do is import PP deep now I do want an error message readable error message to be displayed when PP deep is not installed so let's do a try accept and we will catch the exception import error so if an error happens during the import we will say print here module PP deep missing install PIP install PP deep like this now we can already test this for calc here okay and we get output like this now this is the default that's example in my template but you can see here that the there was no error I have already installed PP deep here on this machine now what I do to test this here typically is import something that doesn't exist like PP deep X let's try that okay and that did not work okay here module PP deep missing yes I have the warning I forgot to add an exit exit minus one like that okay module PP deep missing install PIP install PP deep and if it is installed then we have that behavior okay so let's change that I go to the end of the program and scroll a bit up and here see the line put your data processing code here so what we have here is first of all output of for a line that tells us which file it is that's what we see here we are going to keep this and then here an ASCII dump of the beginning of the file that's what you have here that I'm not going to use neither this so I'm throwing that away this one here to output CSV I'm going to use that later so I'm going to put this as a comment so and what I'm going to do here is output line I calculate the SSD pass so SS deep hash equals PP deep hash data because in my binary template the files that you provided here the content of the file is in variable data and this works for files for a file inside a zip file also for files through file through standard in and and also with a JSON input all this works and it's always in data so just by doing this I have calculated the SSD hash and I'm just going to output this and let's try and that's the output that he have let's compare with the XZ and that is the output that we have now let's continue I also want to print a score I compare the comparison and get a score for that I'm going to use an option at the end here I can do options so I'm going to copy the output option because that's a option that takes a string and that's what I want so see compare default it's an empty string and here provide SSD comparison hash like that and let's go back here okay so I've calculated my hash here now I'm going to test if options compare if that's different format empty string if it's different from empty string we have a hash and then we do the comparison so PP deep compare SSD deep hash to options compare and now it's something I'm going to change later but I'm going to output the comparison before I output the hash that's strange but something that I'm going to change later on in the next step I print the comparison so if I run this like this I have just that output then let me copy this hash and then compare this hash to this hash and we have a score of 100 here because it's very similar it's identical actually I can also compare this to SSD by and there it's zero because it's very different one is a Python program the other is a compiled executable okay now with that SSD Python program so like I said it takes many files also as input you can see it calculates for four different files here in this directory you can also do it from standard in so this is test and pipe this into SSD like this and then you get a small hash because it's small input and also if I put for example calculator into a password protected file and I have a very small bad file to do that zp so this will compress calc.exe into a zip file and use password infected like this you can see here the file well if you run SSD on this one here it will extract the file from memory and compare that and we can indeed well actually not compare but calculate the hash and we can indeed compare that by doing an SSD and calc take the hash and then here compare this and we have a score of 100 okay now last thing I want to do here is also provide CSV output so here I'm going to add a binary option and I'm going to copy the month option because that's a binary option so the C we cannot use the C for CSV because we already use it for compare so I'm going to use V CSV action start true default is false and provide CSV output let me make some changes here so I have calculated SSD pass and I've calculated the comparison if that is necessary now I'm going to test if options CSV I'm going to output CSV and that's what I can do with this here let's output the row and else I'm going output the not the comparison well comparison and the SSD brush but of course let's do that into one line so we output SSD ash space and then the comparison score like this so SSD brush come back is on here and then we can throw away this now that is the case if we have a comparison if there isn't a comparison I just want to output the hash so I'm going to take this if here and copy this here here we have something to compare if not I will just output the SSD push like so I can throw this away and here I just have the row to output so the row let's actually do this here the row is a list with a file name and the SSD push and then if I do a comparison I append the comparison to the end of the row so so this should work let's do some tests well we can just run the test again yeah indeed here now we see the file name here the hash and then the score this is without score and this is for many files so that has not changed now let's do some CSV output and we yeah it's option V okay ah yeah I have the file name twice so I should not output this when I'm in CSV mode so if not option CSV output this so let's see that again okay and if we do it without then we have it okay so that's what we want and now let's also compare this like so and then again we have an invalid hash format so line 231 as in 1456 it's an invalid format because I don't want the calc here like this this is the actual hash okay so this is working so my input was wrong and indeed now we have a score of 100 and let's see if we do that on all the files then on the two calcs at the actual calc at the calc inside the zip file 100 and there is 0 0 0 now remember that process binary file was a sort of SSD file so let's actually compare the SSD hash of process binary file and see what output that we get okay so now of course 0 for calc for process binary 100 and for SSD and SSD by the back 96 and 97 and because there are modified versions of that process binary file so this seems to work if you want a header here that gives you a file name hash and comparison we can do that so let's copy this if option csv output row and actually copy all of this like this so this here is function process binary file it processes a single binary file and right after that you have process binary files so this is the one that processes many files into a loop by calling process binary file for each individual file so to output a header I'm going to do this here in this function so this header is only output at once so the row file name and SSD patch if we have option compare we also add comparison as an header and if we have csv we output the row which is actually the header so let's try that out indeed now we have a header and if we don't have any csv output then we don't have a header so that's pretty much it the only thing that remains to do here is also update the month page so in all of my tools well most of my Python tools I also I not only have a help but also a month page with option M that gives you an explanation on how to use the tool this is just text in print manual and so this is the text that needs to be updated so this tool is a Python implementation of SSD based on module ppd and yeah you can just continue the explanation here of the tool but I'm going to leave it here