Mais um blog inútil.

Agosto 28, 2008

lulz do c

Arquivar em: Drama, OpenBSD, coding — falso @ 23:56

Como já não blogo há muito tempo decidi vir falar sobre algo completamente inutil. Estava eu a tentar compilar o ircd da ptlink no OpenBSD com o pcc em vez do gcc, quando me deparo com um erro meio estranho…

pcc -I../include -g -O2 -DNDEBUG -c help.c
pcc -I../include -g -O2 -DNDEBUG -c hvc.c
hvc.c, line 100: return value required
*** Error code 1

Achei estranho este tipo de erro, ate porque isto é compilavel em outras circunstancias.

int m_hvc(aClient *cptr, aClient *sptr, int parc, char *parv[])
{
  if(!IsPrivileged(sptr))
    return; /* Linha 100 */
  if(parc < 2)
  {
    if(MyClient(sptr))

Nunca tinha visto “return;” em nenhum codigo na vida, e fiquei a pensar como é que o gcc papa isto sem espinhas. Pus return 0; porque me pareceu bem e o resto do programa compilou bem, mas depois deu problemas a linkar portanto cagay naquilo. Fiz uma experiencia:

{:/home/bud/gcc:48} cat main.c
#include <stdio.h>

int sida() {
        return;
}

int main() {
        printf("%x--\n",sida());

        return 0;
}
{:/home/bud/gcc:49} gcc -o sida main.c
{:/home/bud/gcc:50} ./sida
3bbc634d--
{:/home/bud/gcc:51} ./sida
5357df90--
{:/home/bud/gcc:52} ./sida
b3e1e9d9--

Belo random number generator :-P Com -Wall o gcc ja diz qualquer coisinha

main.c: In function `sida':
main.c:4: warning: `return' with no value, in function returning non-void

Acho que supostamente isto nao devia funcionar? O dcoder teve me a dar umas dicas e disse que o msvc tambem comia os return;. Bastante inútil este post, hein?

Agosto 14, 2008

Import Library for RtlGenRandom

Arquivar em: Drama, Serious Business, Useless, coding, windows — dcoder @ 15:19

Everyone needs cryptographically strong pseudo random numbers in this day and age. From card games to your Paypal HTTPS session, it has become an essential part of secure systems. Now, as a user it’s hard to generate randomness; we all know how many systems are seeded with time(NULL) or the like. That’s why most operating systems have mechanisms to provide randomness to the user. In Unix systems, this is usually done through /dev/?random; on Windows, through the function CryptGenRandom.

(more…)

Abril 27, 2008

Amadores

Arquivar em: Drama, Useless, coding, fail — dcoder @ 1:10

O FiSH é uma valente seca para se compilar - é um facto. Em particular quando se fala em compilá-lo num SO opensores numa arquitectura não x86. A biblioteca MIRACL que aquilo usa é essencialmente o problema aqui. Portanto a escolha lógica é acabar com esta biblioteca e usar uma ligeiramente mais decente.

(more…)

Abril 17, 2008

Cracking X-Chat — part ii

Arquivar em: Cracking, Drama, Uncategorized, Useless, coding, fail — dcoder @ 23:21

Aparentemente saiu uma nova versão do xcrap, 2.8.7a. Eu reparei nisto e lembrei-me que houve um post do falso ha uns tempos que falava de como crackar opensores. Infelizmente, não tenho muito tempo por isso vou ser sucinto.

(more…)

Fevereiro 16, 2008

Windows Vista drama

Arquivar em: Drama, lulz, windows — C-16 @ 10:59

Ois. Adoro quando estou no Vista a trabalhar e a ouvir música e a navegar nas interwebs feliz, contente e descansado da vida quando de repente oiço: BEEEEP. Eis que penso “olá…vai haver marosca!”. O portátil reinicia….transpiro e fico verde. Mordo o lábio, lanço um ou outro grunhido e não tenho outro remédio senão reduzir-me à minha significância e aceitar a minha condição de pseudo-(windows fag) e….enfim, esperar que esta merda lá reinicie e tenha de abrir tudo novamente, restaurar a sessão do Firefox, apoiar a cabeça na palma da mão, suspirar, olhar para o lado, pensar para o íntimo do meu arrependimento “Maldita hora em que não pus linux nesta merda…”. Adeus.

P.S. - O que vale é o SuperFetch do Vista, que torna o load das most-used-apps ultra rápido…

Fevereiro 15, 2008

Pensamento do dia

Arquivar em: Drama, Work — cp @ 23:12

E se o estado enfiasse o IRS no cu do jynx, pah ?

Fevereiro 14, 2008

Java drama (CTRL+C)

Arquivar em: Drama, Java, Useless — C-16 @ 18:43

Ois, amiguinhos. Tenho andado um pouco afastado desta rambóia por motivos sérios e profissionais, embora volta e meia faça um ou outro comment a um ou outro post. Sim, confirmo, a vida de pseudo-trabalhador / pseudo-estudante é, de facto, desgastante aborrecida, por vezes. Hoje deparei-me com um drama aqui no trabalhinho que até foi fácil resolver após uns minutinhos a pensar e a pesquisar no gugal. Na minha aplicação existe o try / catch habitual para handlar as exceptions. Existe também um finally para fazer qualquer coisa nomatter what. No entanto, e como estou a correr a aplicação na consola, caso faça um CTRL+C , o troçozinho de código que consta no finally não é executado, o que é uma maçada…Então pensei: “Ora o que eu queria mesmo…era uma forma de handlar este signal….em Java!!” . Em C isto seria coisa simples, mas nunca me tinha deparado com este drama em Java, apesar de a solução ser igualmente simples. Aqui vai a solução e espero que possa ajudar alguém (e também poupar alguma pesquisa):

public class AMinhaClass
{
      public static void main( String[] args )
      {
         Runtime.getRuntime().addShutdownHook( new Thread() {
                 public void run()
                 {
                     System.out.println( "Handler code goes here..." );
                 }
             }
         );
      }
 }

Ahmm…ok, aquilo deveria estar dentro de um ciclo ou qualquer coisa que justifique um handler, mas não me apetece estar a reeditar o post porque não me estou a dar bem com as formatações e o camandro e tenho de voltar para o trabalho. Adeus.

Fevereiro 12, 2008

The Road To February 10, 2008

Arquivar em: Drama — mirage @ 22:51

Serious Business:

Fevereiro 8, 2008

Steve Gibson is a moron.

Arquivar em: Drama — dcoder @ 19:30

I stumbled upon this yesterday. It seems to be some kind of show/podcast where Steve Gibson talks out of his ass. One of them particularly pissed me off.

And it comes from really that bungling attempt I made a couple weeks ago when, well, it was the issue of double encryption, the question we answered several Q&As ago where some guy said hey, you know, what if I encrypt something with one key, then I encrypt it again with another key? Isn’t that, like, much better than encrypting it just once? And I absolutely know that it is, and I know why it is.

Oh really?

I mean, I’ve implemented Rijndael, which is the AES standard, in Assembly language. I know exactly how it works.

Oh, man. In assembly. You really are an expert.

Now, Leo, I found some math genius somewhere on the Internet who she spent her whole life coming up with cool ways to do factorials. I have the size of that number, thanks to her.

This must be really hard, seems to take some kind of math genius. Let’s fire up MAGMA:

> R := RealField();
> N := 2^128;
> size := (N*Log(N) - N + Log(N*(1+4*N*(1+2*N)))/6 + Log(Pi(R))/2)/Log(10);
> size;
1.29639227739158973521399965250E40

Damn, that was hard. Thanks to that math genius called Ramanujan now i know the size of the thing…

Precisely, the size of the total number of possible mappings that 128-bit cipher can have, I mean, it’s just so ridiculously small.

Then he goes around talking about how 2^128 and 2^256 are not huge numbers. I’d love to know in what parallel universe that is.

So the idea is, essentially, you have a bunch of carefully chosen random data, and the key is used, mixed with and to select from a pool of random data. And this is, it’s random, but it’s always the same.

OK, that made sense.

So, for example, public keys, where we were talking about 128 bits being all the strength you would ever need, public keys need to be 1024 bits in order to have the equivalent strength.

So NSA’s suite B doesn’t exist, right? Where ECC-256, ECC-384 and ECC-521 match 128, 192 and 256-bit symmetric key sizes, respectively. The sizes are double the size because with public key number theoretic algorithms one can always use Pollard’s Rho which runs in average for 2^(n/2) iterations.

So again, the guys who did Rijndael said okay, we’re aware of side-channel attacks. We’re going to make what Rijndael does not key dependent.

Right.

Now, for the main point. Is double encryption a good idea? Steve here thinks it is:

So the fact is, the original question that was asked back on Episode 120 was, if I encrypt it twice, with different keys, isn’t that better than once? And it’s absolutely the case that it is because, remember, somebody would be looking at the output from the second encryption, and the only attack is a brute force attack trying keys, you know, like a dictionary attack. And they would be looking for it to get plaintext out of the decryption. But the plaintext out of the second encryption is the encryption from the first, which means there is never going to be any plaintext. And as we’ve seen, the key spaces are such that there’s just no chance another one of those keys, I mean, virtually no chance another one of those keys is going to magically perform the double encryption for you. That’s just not - you have no access to the total number of mappings that are possible through a 128-bit block cipher.

Once again, our friendly security expert is short of the facts. One can use a meet-in-the-middle attack to break double encryption in only 2^(n+1) iterations. Yes, double the keysize and only double, not squared security? Yeah that’s a great idea.
He also mentions 3DES as an example of multiple encryption. But he fails to mention 3DES people actually knew what they were doing. The actual 3DES key is 112, not 168 bit. Triple encryption is only used to thwart meet-in-the-middle attacks, which apparently our expert knows nothing about. So if your tinfoil hat makes you think your key is too short, don’t be an idiot and just use a cipher that allows larger keys.

Steve Gibson is a moron. QED.

Fevereiro 7, 2008

KIT software legal da FNAC

Arquivar em: Drama, Useless, lulz — cp @ 20:01

Já viram o novo “produto exclusivo” da fnac? O KIT SOFTWARE LEGAL? Agora pela módica (leia-se mórbida) quantia de 269.99 eur toda a gente pode usufruir deste fantástico produto.

KIT SOFTWARE LEGAL

« Older Entries

Made on a Mac Powered by OpenBSD