obash icon indicating copy to clipboard operation
obash copied to clipboard

Portability issues on MacOS

Open tripleee opened this issue 9 years ago • 4 comments

Not a proper bug report, but since you asked for portability reports, here's the output from attempting to compile on a pretty basic Yosemite install with Xcode. (This is two versions behind, mind you. I'll try again when I have upgraded to Sierra if you like.)

ordinatrix:tmp tripleee$ git clone [email protected]:louigi600/obash.git
Cloning into 'obash'...
remote: Counting objects: 100, done.
remote: Compressing objects: 100% (70/70), done.
remote: Total 100 (delta 52), reused 66 (delta 27), pack-reused 0
Receiving objects: 100% (100/100), 36.20 KiB | 0 bytes/s, done.
Resolving deltas: 100% (52/52), done.
Checking connectivity... done.

ordinatrix:tmp tripleee$ cd obash/

ordinatrix:obash tripleee$ make
./recreate_interpreter_header
cc obash.c -o obash -lssl -lcrypto
In file included from obash.c:29:
./functions.h:22:5: error: conflicting types for 'encrypt'
int encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *...
    ^
/usr/include/unistd.h:544:7: note: previous declaration is here
void     encrypt(char *, int) __DARWIN_ALIAS(encrypt);
         ^
In file included from obash.c:30:
./functions.c:128:5: error: conflicting types for 'encrypt'
int encrypt(unsigned char *plaintext, int plaintext_len, unsigned char *...
    ^
/usr/include/unistd.h:544:7: note: previous declaration is here
void     encrypt(char *, int) __DARWIN_ALIAS(encrypt);
         ^
In file included from obash.c:30:
./functions.c:134:14: warning: 'EVP_CIPHER_CTX_new' is deprecated: first
      deprecated in OS X 10.7 [-Wdeprecated-declarations]
  if(!(ctx = EVP_CIPHER_CTX_new())) exit(1);
             ^
/usr/include/openssl/evp.h:638:17: note: 'EVP_CIPHER_CTX_new' has been
      explicitly marked deprecated here
EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void) DEPRECATED_IN_MAC_OS_X_VERSION_...
                ^
In file included from obash.c:30:
./functions.c:141:11: warning: 'EVP_EncryptInit_ex' is deprecated: first
      deprecated in OS X 10.7 [-Wdeprecated-declarations]
  if(1 != EVP_EncryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, key, iv))
          ^
/usr/include/openssl/evp.h:580:5: note: 'EVP_EncryptInit_ex' has been explicitly
      marked deprecated here
int     EVP_EncryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher...
        ^
In file included from obash.c:30:
./functions.c:141:35: warning: 'EVP_aes_256_cbc' is deprecated: first deprecated
      in OS X 10.7 [-Wdeprecated-declarations]
  if(1 != EVP_EncryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, key, iv))
                                  ^
/usr/include/openssl/evp.h:779:19: note: 'EVP_aes_256_cbc' has been explicitly
      marked deprecated here
const EVP_CIPHER *EVP_aes_256_cbc(void) DEPRECATED_IN_MAC_OS_X_VERSION_1...
                  ^
In file included from obash.c:30:
./functions.c:146:11: warning: 'EVP_EncryptUpdate' is deprecated: first
      deprecated in OS X 10.7 [-Wdeprecated-declarations]
  if(1 != EVP_EncryptUpdate(ctx, ciphertext, &len, plaintext, plaintext_len))
          ^
/usr/include/openssl/evp.h:582:5: note: 'EVP_EncryptUpdate' has been explicitly
      marked deprecated here
int     EVP_EncryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
        ^
In file included from obash.c:30:
./functions.c:152:11: warning: 'EVP_EncryptFinal_ex' is deprecated: first
      deprecated in OS X 10.7 [-Wdeprecated-declarations]
  if(1 != EVP_EncryptFinal_ex(ctx, ciphertext + len, &len)) exit(1);
          ^
/usr/include/openssl/evp.h:584:5: note: 'EVP_EncryptFinal_ex' has been
      explicitly marked deprecated here
int     EVP_EncryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *out, in...
        ^
In file included from obash.c:30:
./functions.c:156:3: warning: 'EVP_CIPHER_CTX_free' is deprecated: first
      deprecated in OS X 10.7 [-Wdeprecated-declarations]
  EVP_CIPHER_CTX_free(ctx);
  ^
/usr/include/openssl/evp.h:639:6: note: 'EVP_CIPHER_CTX_free' has been
      explicitly marked deprecated here
void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *a) DEPRECATED_IN_MAC_OS_X_VERSI...
     ^
In file included from obash.c:30:
./functions.c:167:14: warning: 'EVP_CIPHER_CTX_new' is deprecated: first
      deprecated in OS X 10.7 [-Wdeprecated-declarations]
  if(!(ctx = EVP_CIPHER_CTX_new())) exit(1);
             ^
/usr/include/openssl/evp.h:638:17: note: 'EVP_CIPHER_CTX_new' has been
      explicitly marked deprecated here
EVP_CIPHER_CTX *EVP_CIPHER_CTX_new(void) DEPRECATED_IN_MAC_OS_X_VERSION_...
                ^
In file included from obash.c:30:
./functions.c:174:11: warning: 'EVP_DecryptInit_ex' is deprecated: first
      deprecated in OS X 10.7 [-Wdeprecated-declarations]
  if(1 != EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, key, iv))
          ^
/usr/include/openssl/evp.h:589:5: note: 'EVP_DecryptInit_ex' has been explicitly
      marked deprecated here
int     EVP_DecryptInit_ex(EVP_CIPHER_CTX *ctx,const EVP_CIPHER *cipher...
        ^
In file included from obash.c:30:
./functions.c:174:35: warning: 'EVP_aes_256_cbc' is deprecated: first deprecated
      in OS X 10.7 [-Wdeprecated-declarations]
  if(1 != EVP_DecryptInit_ex(ctx, EVP_aes_256_cbc(), NULL, key, iv))
                                  ^
/usr/include/openssl/evp.h:779:19: note: 'EVP_aes_256_cbc' has been explicitly
      marked deprecated here
const EVP_CIPHER *EVP_aes_256_cbc(void) DEPRECATED_IN_MAC_OS_X_VERSION_1...
                  ^
In file included from obash.c:30:
./functions.c:179:11: warning: 'EVP_DecryptUpdate' is deprecated: first
      deprecated in OS X 10.7 [-Wdeprecated-declarations]
  if(1 != EVP_DecryptUpdate(ctx, plaintext, &len, ciphertext, ciphertext_len))
          ^
/usr/include/openssl/evp.h:591:5: note: 'EVP_DecryptUpdate' has been explicitly
      marked deprecated here
int     EVP_DecryptUpdate(EVP_CIPHER_CTX *ctx, unsigned char *out,
        ^
In file included from obash.c:30:
./functions.c:185:11: warning: 'EVP_DecryptFinal_ex' is deprecated: first
      deprecated in OS X 10.7 [-Wdeprecated-declarations]
  if(1 != EVP_DecryptFinal_ex(ctx, plaintext + len, &len)) exit(1);
          ^
/usr/include/openssl/evp.h:594:5: note: 'EVP_DecryptFinal_ex' has been
      explicitly marked deprecated here
int     EVP_DecryptFinal_ex(EVP_CIPHER_CTX *ctx, unsigned char *outm, in...
        ^
In file included from obash.c:30:
./functions.c:189:3: warning: 'EVP_CIPHER_CTX_free' is deprecated: first
      deprecated in OS X 10.7 [-Wdeprecated-declarations]
  EVP_CIPHER_CTX_free(ctx);
  ^
/usr/include/openssl/evp.h:639:6: note: 'EVP_CIPHER_CTX_free' has been
      explicitly marked deprecated here
void EVP_CIPHER_CTX_free(EVP_CIPHER_CTX *a) DEPRECATED_IN_MAC_OS_X_VERSI...
     ^
In file included from obash.c:30:
./functions.c:200:9: warning: 'BIO_new' is deprecated: first deprecated in OS X
      10.7 [-Wdeprecated-declarations]
  b64 = BIO_new(BIO_f_base64());
        ^
/usr/include/openssl/bio.h:591:7: note: 'BIO_new' has been explicitly marked
      deprecated here
BIO *   BIO_new(BIO_METHOD *type) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
        ^
In file included from obash.c:30:
./functions.c:200:17: warning: 'BIO_f_base64' is deprecated: first deprecated in
      OS X 10.7 [-Wdeprecated-declarations]
  b64 = BIO_new(BIO_f_base64());
                ^
/usr/include/openssl/evp.h:647:13: note: 'BIO_f_base64' has been explicitly
      marked deprecated here
BIO_METHOD *BIO_f_base64(void) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
            ^
In file included from obash.c:30:
./functions.c:201:10: warning: 'BIO_new_mem_buf' is deprecated: first deprecated
      in OS X 10.7 [-Wdeprecated-declarations]
  bmem = BIO_new_mem_buf(input, length);
         ^
/usr/include/openssl/bio.h:627:6: note: 'BIO_new_mem_buf' has been explicitly
      marked deprecated here
BIO *BIO_new_mem_buf(void *buf, int len) DEPRECATED_IN_MAC_OS_X_VERSION_...
     ^
In file included from obash.c:30:
./functions.c:202:10: warning: 'BIO_push' is deprecated: first deprecated in OS
      X 10.7 [-Wdeprecated-declarations]
  bmem = BIO_push(b64, bmem);
         ^
/usr/include/openssl/bio.h:604:7: note: 'BIO_push' has been explicitly marked
      deprecated here
BIO *   BIO_push(BIO *b,BIO *append) DEPRECATED_IN_MAC_OS_X_VERSION_10_7...
        ^
In file included from obash.c:30:
./functions.c:204:3: warning: 'BIO_read' is deprecated: first deprecated in OS X
      10.7 [-Wdeprecated-declarations]
  BIO_read(bmem, buffer, length);
  ^
/usr/include/openssl/bio.h:595:5: note: 'BIO_read' has been explicitly marked
      deprecated here
int     BIO_read(BIO *b, void *data, int len) DEPRECATED_IN_MAC_OS_X_VER...
        ^
In file included from obash.c:30:
./functions.c:206:3: warning: 'BIO_free_all' is deprecated: first deprecated in
      OS X 10.7 [-Wdeprecated-declarations]
  BIO_free_all(bmem);
  ^
/usr/include/openssl/bio.h:606:6: note: 'BIO_free_all' has been explicitly
      marked deprecated here
void    BIO_free_all(BIO *a) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
        ^
In file included from obash.c:30:
./functions.c:215:9: warning: 'BIO_new' is deprecated: first deprecated in OS X
      10.7 [-Wdeprecated-declarations]
  b64 = BIO_new(BIO_f_base64());
        ^
/usr/include/openssl/bio.h:591:7: note: 'BIO_new' has been explicitly marked
      deprecated here
BIO *   BIO_new(BIO_METHOD *type) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
        ^
In file included from obash.c:30:
./functions.c:215:17: warning: 'BIO_f_base64' is deprecated: first deprecated in
      OS X 10.7 [-Wdeprecated-declarations]
  b64 = BIO_new(BIO_f_base64());
                ^
/usr/include/openssl/evp.h:647:13: note: 'BIO_f_base64' has been explicitly
      marked deprecated here
BIO_METHOD *BIO_f_base64(void) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
            ^
In file included from obash.c:30:
./functions.c:216:10: warning: 'BIO_new' is deprecated: first deprecated in OS X
      10.7 [-Wdeprecated-declarations]
  bmem = BIO_new(BIO_s_mem());
         ^
/usr/include/openssl/bio.h:591:7: note: 'BIO_new' has been explicitly marked
      deprecated here
BIO *   BIO_new(BIO_METHOD *type) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
        ^
In file included from obash.c:30:
./functions.c:216:18: warning: 'BIO_s_mem' is deprecated: first deprecated in OS
      X 10.7 [-Wdeprecated-declarations]
  bmem = BIO_new(BIO_s_mem());
                 ^
/usr/include/openssl/bio.h:626:13: note: 'BIO_s_mem' has been explicitly marked
      deprecated here
BIO_METHOD *BIO_s_mem(void) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
            ^
In file included from obash.c:30:
./functions.c:217:9: warning: 'BIO_push' is deprecated: first deprecated in OS X
      10.7 [-Wdeprecated-declarations]
  b64 = BIO_push(b64, bmem);
        ^
/usr/include/openssl/bio.h:604:7: note: 'BIO_push' has been explicitly marked
      deprecated here
BIO *   BIO_push(BIO *b,BIO *append) DEPRECATED_IN_MAC_OS_X_VERSION_10_7...
        ^
In file included from obash.c:30:
./functions.c:218:3: warning: 'BIO_write' is deprecated: first deprecated in OS
      X 10.7 [-Wdeprecated-declarations]
  BIO_write(b64, input, length);
  ^
/usr/include/openssl/bio.h:597:5: note: 'BIO_write' has been explicitly marked
      deprecated here
int     BIO_write(BIO *b, const void *data, int len) DEPRECATED_IN_MAC_O...
        ^
In file included from obash.c:30:
./functions.c:219:3: warning: 'BIO_ctrl' is deprecated: first deprecated in OS X
      10.7 [-Wdeprecated-declarations]
  BIO_flush(b64);
  ^
/usr/include/openssl/bio.h:529:28: note: expanded from macro 'BIO_flush'
#define BIO_flush(b)            (int)BIO_ctrl(b,BIO_CTRL_FLUSH,0,NULL)
                                     ^
/usr/include/openssl/bio.h:600:6: note: 'BIO_ctrl' has been explicitly marked
      deprecated here
long    BIO_ctrl(BIO *bp,int cmd,long larg,void *parg) DEPRECATED_IN_MAC...
        ^
In file included from obash.c:30:
./functions.c:220:3: warning: 'BIO_ctrl' is deprecated: first deprecated in OS X
      10.7 [-Wdeprecated-declarations]
  BIO_get_mem_ptr(b64, &bptr);
  ^
/usr/include/openssl/bio.h:506:31: note: expanded from macro 'BIO_get_mem_ptr'
#define BIO_get_mem_ptr(b,pp)   BIO_ctrl(b,BIO_C_GET_BUF_MEM_PTR,0,(char *)pp)
                                ^
/usr/include/openssl/bio.h:600:6: note: 'BIO_ctrl' has been explicitly marked
      deprecated here
long    BIO_ctrl(BIO *bp,int cmd,long larg,void *parg) DEPRECATED_IN_MAC...
        ^
In file included from obash.c:30:
./functions.c:226:3: warning: 'BIO_free_all' is deprecated: first deprecated in
      OS X 10.7 [-Wdeprecated-declarations]
  BIO_free_all(b64);
  ^
/usr/include/openssl/bio.h:606:6: note: 'BIO_free_all' has been explicitly
      marked deprecated here
void    BIO_free_all(BIO *a) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
        ^
In file included from obash.c:30:
./functions.c:264:3: warning: 'ERR_load_crypto_strings' is deprecated: first
      deprecated in OS X 10.7 [-Wdeprecated-declarations]
  ERR_load_crypto_strings();
  ^
/usr/include/openssl/err.h:296:6: note: 'ERR_load_crypto_strings' has been
      explicitly marked deprecated here
void ERR_load_crypto_strings(void) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_A...
     ^
In file included from obash.c:30:
./functions.c:265:3: warning: 'OPENSSL_add_all_algorithms_noconf' is deprecated:
      first deprecated in OS X 10.7 [-Wdeprecated-declarations]
  OpenSSL_add_all_algorithms();
  ^
/usr/include/openssl/evp.h:829:3: note: expanded from macro
      'OpenSSL_add_all_algorithms'
                OPENSSL_add_all_algorithms_noconf()
                ^
/usr/include/openssl/evp.h:821:6: note: 'OPENSSL_add_all_algorithms_noconf' has
      been explicitly marked deprecated here
void OPENSSL_add_all_algorithms_noconf(void) DEPRECATED_IN_MAC_OS_X_VERS...
     ^
In file included from obash.c:30:
./functions.c:266:3: warning: 'OPENSSL_no_config' is deprecated: first
      deprecated in OS X 10.7 [-Wdeprecated-declarations]
  OPENSSL_no_config();
  ^
/usr/include/openssl/conf.h:136:6: note: 'OPENSSL_no_config' has been explicitly
      marked deprecated here
void OPENSSL_no_config(void) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
     ^
In file included from obash.c:30:
./functions.c:273:36: error: too many arguments to function call, expected 2,
      have 5
  ctsize=encrypt (plaintext,insize,key,iv,ciphertext); 
         ~~~~~~~                   ^~~~~~~~~~~~~~~~~
/usr/include/unistd.h:544:1: note: 'encrypt' declared here
void     encrypt(char *, int) __DARWIN_ALIAS(encrypt);
^
In file included from obash.c:30:
./functions.c:274:9: warning: assigning to 'unsigned char *' from 'char *'
      converts between pointers to integer types with different sign
      [-Wpointer-sign]
  b64ctx=base64(ciphertext,ctsize);
        ^~~~~~~~~~~~~~~~~~~~~~~~~~
./functions.c:281:68: warning: passing 'unsigned char *' to parameter of type
      'const char *' converts between pointers to integer types with different
      sign [-Wpointer-sign]
  ...encoded ciphertext: %i : %i whole lines\n",strlen(b64ctx),strlen(b64ctx)...
                                                       ^~~~~~
/usr/include/string.h:82:28: note: passing argument to parameter here
size_t   strlen(const char *);
                            ^
In file included from obash.c:30:
./functions.c:281:83: warning: passing 'unsigned char *' to parameter of type
      'const char *' converts between pointers to integer types with different
      sign [-Wpointer-sign]
  ...ciphertext: %i : %i whole lines\n",strlen(b64ctx),strlen(b64ctx)/65);
                                                              ^~~~~~
/usr/include/string.h:82:28: note: passing argument to parameter here
size_t   strlen(const char *);
                            ^
In file included from obash.c:30:
./functions.c:281:61: warning: format specifies type 'int' but the argument has
      type 'unsigned long' [-Wformat]
  ...encoded ciphertext: %i : %i whole lines\n",strlen(b64ctx),strlen(b64ctx)...
                         ~~                     ^~~~~~~~~~~~~~
                         %lu
./functions.c:281:76: warning: format specifies type 'int' but the argument has
      type 'unsigned long' [-Wformat]
  ...ciphertext: %i : %i whole lines\n",strlen(b64ctx),strlen(b64ctx)/65);
                      ~~                               ^~~~~~~~~~~~~~~~~
                      %lu
./functions.c:295:21: warning: passing 'unsigned char *' to parameter of type
      'const char *' converts between pointers to integer types with different
      sign [-Wpointer-sign]
  for (i=0;i<strlen(b64ctx)/65;i++)
                    ^~~~~~
/usr/include/string.h:82:28: note: passing argument to parameter here
size_t   strlen(const char *);
                            ^
In file included from obash.c:30:
./functions.c:303:21: warning: passing 'unsigned char *' to parameter of type
      'const char *' converts between pointers to integer types with different
      sign [-Wpointer-sign]
  if((i*65)< strlen(b64ctx))
                    ^~~~~~
/usr/include/string.h:82:28: note: passing argument to parameter here
size_t   strlen(const char *);
                            ^
In file included from obash.c:30:
./functions.c:305:35: warning: passing 'unsigned char *' to parameter of type
      'const char *' converts between pointers to integer types with different
      sign [-Wpointer-sign]
    fwrite(b64ctx+(65*i),1,strlen(b64ctx)-(65*i),outfile);
                                  ^~~~~~
/usr/include/string.h:82:28: note: passing argument to parameter here
size_t   strlen(const char *);
                            ^
In file included from obash.c:30:
./functions.c:358:3: warning: 'EVP_cleanup' is deprecated: first deprecated in
      OS X 10.7 [-Wdeprecated-declarations]
  EVP_cleanup();
  ^
/usr/include/openssl/evp.h:843:6: note: 'EVP_cleanup' has been explicitly marked
      deprecated here
void EVP_cleanup(void) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
     ^
In file included from obash.c:30:
./functions.c:359:3: warning: 'ERR_free_strings' is deprecated: first deprecated
      in OS X 10.7 [-Wdeprecated-declarations]
  ERR_free_strings();
  ^
/usr/include/openssl/err.h:297:6: note: 'ERR_free_strings' has been explicitly
      marked deprecated here
void ERR_free_strings(void) DEPRECATED_IN_MAC_OS_X_VERSION_10_7_AND_LATER;
     ^
In file included from obash.c:31:
./interpreter.h:1:1: error: expected external declaration
-n char *includes=
^
./interpreter.h:1:2: error: unknown type name 'n'
-n char *includes=
 ^
./interpreter.h:1:4: error: expected identifier or '('
-n char *includes=
   ^
./interpreter.h:22:2: warning: null character(s) preserved in string literal
      [-Wnull-character]
"
 ^
./interpreter.h:23:1: error: expected external declaration
-n char *functions=
^
./interpreter.h:23:2: error: unknown type name 'n'
-n char *functions=
 ^
./interpreter.h:23:4: error: expected identifier or '('
-n char *functions=
   ^
./interpreter.h:264:2: warning: null character(s) preserved in string literal
      [-Wnull-character]
"
 ^
./interpreter.h:265:1: error: expected external declaration
-n char *main_body=
^
./interpreter.h:265:2: error: unknown type name 'n'
-n char *main_body=
 ^
./interpreter.h:265:4: error: expected identifier or '('
-n char *main_body=
   ^
./interpreter.h:339:2: warning: null character(s) preserved in string literal
      [-Wnull-character]
"
 ^
obash.c:90:18: warning: format string contains '\0' within the string body
      [-Wformat]
  sprintf(param,"\0");
                ~^~~
/usr/include/secure/_stdio.h:47:56: note: expanded from macro 'sprintf'
  __builtin___sprintf_chk (str, 0, __darwin_obsz(str), __VA_ARGS__)
                                                       ^
obash.c:246:17: warning: data argument not used by format string
      [-Wformat-extra-args]
  printf("... ",input_filename); 
         ~~~~~~ ^
45 warnings and 12 errors generated.
make: *** [obash] Error 1

tripleee avatar Feb 14 '17 05:02 tripleee

What ssl implementation does mac use ? Can you find a way to send me back (or even attach here) the interpreter.h that got generated on your mac ?

louigi600 avatar Feb 14 '17 07:02 louigi600

This is what the generated interpreter.h should look like. interpreter.zip

louigi600 avatar Feb 14 '17 08:02 louigi600

Ok now uuid and serial are correctly retreived on mac osx. Pending a solution to maintain interactive obfuscated scripts and prevent clear script from showing via ps.

louigi600 avatar Feb 14 '17 19:02 louigi600

I've got it working on FreeBSD and there are good chances that it may work on OpenBSD too. I think it's a specific issue on Mac ... but I'll still not close this just as a reminder to keep on trying to get it to work on mac.

louigi600 avatar Feb 16 '17 17:02 louigi600