Developers

From CGSecurity
(Redirected from DevelopersIT)
Jump to navigation Jump to search

En.png English


Hosting

Download source code, ready-to-use binaries of TestDisk & PhotoRec, consult the documentations. It's a wiki, you can create an account and improve the English documentation or the translations.

Evaluate your knowledge with multiple choice questions about data recovery, TestDisk & PhotoRec.

Create your local copy of the development tree using git clone https://git.cgsecurity.org/testdisk.git
Consult the source via a web interface https://git.cgsecurity.org/cgit/

Need help ? Ready to help others ? Consult the forum.

TestDisk and the rest of the world

Let's Encrypt - SSL certificates

All the URL of the project are available in https thanks to Letsencrypt. testdisk project uses Let's Encrypt to get free X.509 certificates for Transport Layer Security (TLS) encryption via an automated process.

Github - git repository and issue tracker

testdisk is available on github at https://github.com/cgsecurity/testdisk It's a mirror of the official git repository https://git.cgsecurity.org/testdisk.git

Certum - Open Source Code Signing

This commercial Certificat Autority provides code signing for a reasonable annual fee for open source project. This certificate is used to sign Windows binaries distributed on https://www.cgsecurity.org

Fedora Copr - automatic build system

Copr automatically builds testdisk for CentOS and Fedora Linux distributions.

Travis CI - automatic build system

testdisk is build automatically on Travis CI system (See configuration)

Transifex - localization platform

Transifex provides a localisation plateform to testdisk. Accessible to non-developers, it's used to translate QPhotoRec, the GUI version of PhotoRec, in multiples languages.

Coverity Scan - static analyzer

This static analyzer checks the source code for various defects and vulnerabilities.

SWAMP - various static analyzers

Software Assurance Marketplace runs several static code analyzers on git repository daily.

Open Invention Network - defensive patent pool and community of patent non-aggression

To support patent non-aggression, testdisk is a member of OIN Community. testdisk projet has free access to OIN’s patents and royalty free access to Linux System patents of other OIN participants.

CII Best Practices

Core Infrastructure Initiative (CII) best practice badge in progress

Using Git to get latest source code

Git is a modern source code manager, see Git article from Wikipedia for details. To learn to use git, read the man page giteveryday (man giteveryday).

https://git.cgsecurity.org/testdisk.git is a Git repository to track TestDisk & PhotoRec source code, you can browse it using https://git.cgsecurity.org/cgit/testdisk/ or via github https://github.com/cgsecurity/testdisk

Install git using

  • yum install git for Fedora, RedHat, Centos
  • sudo apt-get install git-core for Debian, Ubuntu

Configure your local settings

$ git config --global user.name "Your Name"
$ git config --global user.email "Your Email"

Clone the current source code

$ git clone https://git.cgsecurity.org/testdisk.git

If you have already cloned the project, to update your local copy, run git pull from the testdisk directory.

Compile TestDisk & PhotoRec

$ cd testdisk
$ mkdir config
$ autoreconf --install -W all -I config
$ ./configure
$ make

If autoreconf is missing, check that automake and autoconf are present, otherwise you can replace the autoreconf command by

$ aclocal -I config
$ autoheader -W all
$ autoconf -W all
$ automake --gnits --add-missing --copy

Read TestDisk Compilation if you have problems to compile TestDisk & PhotoRec

It's time to make your own modifications and submit the patch (pull request are also ok)

$ (edit files)
$ git add (files)
$ git commit -a
$ git format-patch origin/master
$ ls *.patch

Coding style

  • Have you checked for compiler warnings? Warnings often point to real bugs.
  • Be consistent with existing code
  • No whitespace at the end of a line.
  • Unix-style linebreaks ('\n'), not Windows-style ('\r\n').
  • Indentation

Two spaces per logic level

  • The #define Guard

All header files should have #define guards to prevent multiple inclusion. The format of the symbol name should be _<FILE>_H_.

  • Local Variables

Place a function's variables in the narrowest scope possible

  • Use const whenever it makes sense.
  • null value

Use 0 for integers, 0.0 for reals, NULL for pointers, and '\0' for chars.

  • Prefer sizeof(varname) to sizeof(type).
  • if, for, while: all braces on their own lines

Download source code

If you have been unable to install git, download a snapshot of TestDisk & PhotoRec latest source code. Get the beta version, the Work-In-Progress (WIP) one.

Adding a new file format to PhotoRec

The first step is to check if PhotoRec already identify the file. Run fidentify sample_file. If the file is identified with an incorrect extension, check if there is way to differentiate this file from files having the extension that has been found. If fidentify reports the format as unknown, you have found a candidate for inclusion.

If the file format specifications aren't available, compare several samples to identify constant fields. In example, PhotoRec identifies a JPEG file when a block begins with:

  • 0xff,0xd8,0xff,0xe0
  • 0xff,0xd8,0xff,0xe1
  • or 0xff,0xd8,0xff,0xfe


To add a new file format to PhotoRec,

  extern const file_hint_t file_hint_<EXTENSION>;
  • and in list_file_enable[]
  { .enable=0, .file_hint=&file_hint_<EXTENSION> },
       file_<EXTENSION>.c
  • If there is a header file, add it to file_H definition
  • Create a file name src/file_<EXTENSION>.c.
  • Register the various MAGIC header in register_header_check_EXTENSION()

In this example, file_check_EXTENSION() is used to check for a footer.

Check

qphotorec: PhotoRec with a Qt GUI

QPhotoRec is now build by default since TestDisk & PhotoRec 7.0 if Qt development package is available :

./configure && make