[-] Irelephant@lemm.ee 1 points 1 month ago

I just wish proton mail supported clients.

[-] Irelephant@lemm.ee 1 points 1 month ago

Out of interest, how does the spam find a self hosted email? If i, for example, only submitted it one two sites where it was never leaked, and i never publicly posted it?

[-] Irelephant@lemm.ee 1 points 3 months ago

I'm trying to send a post request to Pastebins api to make a paste. This is one of the first programs I have tried to write with libcurl, so its probably wrong.

[-] Irelephant@lemm.ee 1 points 3 months ago

I have written code before. I just started with C recently. I am expecting it to do literally anything at this point, but for some reason whenever I use the libcurl library literally nothing happens that i can observe.

[-] Irelephant@lemm.ee 1 points 3 months ago

Ah, right.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <curl/curl.h>

struct MemoryStruct {
    char *memory;
    size_t size;
};

size_t WriteMemoryCallback(void *contents, size_t size, size_t nmemb, struct MemoryStruct *userp) {
    size_t realsize = size * nmemb;
    userp->memory = realloc(userp->memory, userp->size + realsize + 1);
    if(userp->memory == NULL) {
        return 0;
    }
    memcpy(&(userp->memory[userp->size]), contents, realsize);
    userp->size += realsize;
    userp->memory[userp->size] = 0;
    return realsize;
}

int main(int argc, char *argv[]) {
    CURLcode ret;
    CURL *hnd;
    struct MemoryStruct chunk;

    chunk.memory = malloc(1);
    chunk.size = 0;

    hnd = curl_easy_init();
    if(hnd) {
        curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
        curl_easy_setopt(hnd, CURLOPT_URL, "https://pastebin.com/api/api_post.php");
        curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 1L);
        curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "api_dev_key=API_KEY_HERE&api_paste_code=test&api_option=paste");
        curl_easy_setopt(hnd, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)81);
        curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/8.9.1");
        curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
        curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
        curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L);
        curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);
        curl_easy_setopt(hnd, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
        curl_easy_setopt(hnd, CURLOPT_WRITEDATA, (void *)&chunk);

        ret = curl_easy_perform(hnd);

        if(ret != CURLE_OK) {
            fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(ret));
        } else {
            printf("%s\n", chunk.memory);
        }

        curl_easy_cleanup(hnd);
        free(chunk.memory);
    } else {
        fprintf(stderr, "Failed to initialize CURL\n");
    }

    return (int)ret;
}

Finished it, i think. Still does "nothing"

edit: probably shouldn't include my api key with it.

[-] Irelephant@lemm.ee 1 points 3 months ago

You're right, but it doesn't do anything, no matter what the code is, so I assumed that I needn't include it. Kinda stupid of me. In any case, here it is:

/********* Sample code generated by the curl command line tool **********
 * All curl_easy_setopt() options are documented at:
 * https://curl.se/libcurl/c/curl_easy_setopt.html
 ************************************************************************/
#include <curl/curl.h>

int main(int argc, char *argv[])
{
  CURLcode ret;
  CURL *hnd;

  hnd = curl_easy_init();
  curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
  curl_easy_setopt(hnd, CURLOPT_URL, "https://pastebin.com/api/api_post.php");
  curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 1L);
  curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "api_dev_key=MY_API_KEY&api_paste_code=test&api_option=paste");
  curl_easy_setopt(hnd, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)81);
  curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/8.9.1");
  curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
  curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
  curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L);
  curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);

  /* Here is a list of options the curl code used that cannot get generated
     as source easily. You may choose to either not use them or implement
     them yourself.

  CURLOPT_WRITEDATA was set to an object pointer
  CURLOPT_WRITEFUNCTION was set to a function pointer
  CURLOPT_READDATA was set to an object pointer
  CURLOPT_READFUNCTION was set to a function pointer
  CURLOPT_SEEKDATA was set to an object pointer
  CURLOPT_SEEKFUNCTION was set to a function pointer
  CURLOPT_ERRORBUFFER was set to an object pointer
  CURLOPT_STDERR was set to an object pointer
  CURLOPT_HEADERFUNCTION was set to a function pointer
  CURLOPT_HEADERDATA was set to an object pointer

  */

  ret = curl_easy_perform(hnd);

  curl_easy_cleanup(hnd);
  hnd = NULL;

  return (int)ret;
}
/**** End of sample code ****/

Another piece of code i tried was:

#include <stdio.h>
#include <curl/curl.h>

int main(void) {
    CURL *curl;
    CURLcode res;


    curl_global_init(CURL_GLOBAL_DEFAULT);
    curl = curl_easy_init();

    if(curl) {
       
        curl_easy_setopt(curl, CURLOPT_URL, "http://localhost:5000/a");

     
        const char *data = "hello!";
        curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);


        res = curl_easy_perform(curl);

     
        if(res != CURLE_OK) {
            fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
        }

  
        curl_easy_cleanup(curl);
    }

  
    curl_global_cleanup();

    return 0;
}

compiled it with gcc test.c -o test.exe -IC:\Users\MY_USERNAME\scoop\apps\curl\current\include -LC:\Users\MY_USERNAME\scoop\apps\curl\current\lib -lcurl but you can replace the paths with wherever the libcurl include directory is (i hope).

[-] Irelephant@lemm.ee 1 points 3 months ago

You're right, but it doesn't do anything, no matter what the code is, so I assumed that I needn't include it. Kinda stupid of me. In any case, here it is:

/********* Sample code generated by the curl command line tool **********
 * All curl_easy_setopt() options are documented at:
 * https://curl.se/libcurl/c/curl_easy_setopt.html
 ************************************************************************/
#include <curl/curl.h>

int main(int argc, char *argv[])
{
  CURLcode ret;
  CURL *hnd;

  hnd = curl_easy_init();
  curl_easy_setopt(hnd, CURLOPT_BUFFERSIZE, 102400L);
  curl_easy_setopt(hnd, CURLOPT_URL, "https://pastebin.com/api/api_post.php");
  curl_easy_setopt(hnd, CURLOPT_NOPROGRESS, 1L);
  curl_easy_setopt(hnd, CURLOPT_POSTFIELDS, "api_dev_key=MY_API_KEY&api_paste_code=test&api_option=paste");
  curl_easy_setopt(hnd, CURLOPT_POSTFIELDSIZE_LARGE, (curl_off_t)81);
  curl_easy_setopt(hnd, CURLOPT_USERAGENT, "curl/8.9.1");
  curl_easy_setopt(hnd, CURLOPT_MAXREDIRS, 50L);
  curl_easy_setopt(hnd, CURLOPT_CUSTOMREQUEST, "POST");
  curl_easy_setopt(hnd, CURLOPT_FTP_SKIP_PASV_IP, 1L);
  curl_easy_setopt(hnd, CURLOPT_TCP_KEEPALIVE, 1L);

  /* Here is a list of options the curl code used that cannot get generated
     as source easily. You may choose to either not use them or implement
     them yourself.

  CURLOPT_WRITEDATA was set to an object pointer
  CURLOPT_WRITEFUNCTION was set to a function pointer
  CURLOPT_READDATA was set to an object pointer
  CURLOPT_READFUNCTION was set to a function pointer
  CURLOPT_SEEKDATA was set to an object pointer
  CURLOPT_SEEKFUNCTION was set to a function pointer
  CURLOPT_ERRORBUFFER was set to an object pointer
  CURLOPT_STDERR was set to an object pointer
  CURLOPT_HEADERFUNCTION was set to a function pointer
  CURLOPT_HEADERDATA was set to an object pointer

  */

  ret = curl_easy_perform(hnd);

  curl_easy_cleanup(hnd);
  hnd = NULL;

  return (int)ret;
}
/**** End of sample code ****/

Another piece of code i tried was:

#include <stdio.h>
#include <curl/curl.h>

int main(void) {
    CURL *curl;
    CURLcode res;


    curl_global_init(CURL_GLOBAL_DEFAULT);
    curl = curl_easy_init();

    if(curl) {
       
        curl_easy_setopt(curl, CURLOPT_URL, "http://localhost:5000/a");

     
        const char *data = "hello!";
        curl_easy_setopt(curl, CURLOPT_POSTFIELDS, data);


        res = curl_easy_perform(curl);

     
        if(res != CURLE_OK) {
            fprintf(stderr, "curl_easy_perform() failed: %s\n", curl_easy_strerror(res));
        }

  
        curl_easy_cleanup(curl);
    }

  
    curl_global_cleanup();

    return 0;
}

compiled it with gcc test.c -o test.exe -IC:\Users\MY_USERNAME\scoop\apps\curl\current\include -LC:\Users\MY_USERNAME\scoop\apps\curl\current\lib -lcurl but you can replace the paths with wherever the libcurl include directory is (i hope).

[-] Irelephant@lemm.ee 1 points 3 months ago

Not the guy, but the message content is encrypted, and cannot be seen. Metadata about the message is visible, like when you sent it and who you messaged. They're being a bit extreme, everyone uses whatsapp where i live.

[-] Irelephant@lemm.ee 1 points 3 months ago

Shit. I still have 21 days. I had some scripts made with the api that i'm going to have to remake now.

[-] Irelephant@lemm.ee 1 points 3 months ago

Might this work? https://droidian.org/ another commenter mentioned it.

[-] Irelephant@lemm.ee 1 points 3 months ago

My twitter account is just a link to my mastodon profile, with a script that posts a link to it every week or so to stop it getting banned for inactivity.

view more: ‹ prev next ›

Irelephant

joined 1 year ago