Giter VIP home page Giter VIP logo

wajs's Introduction

Like to built useful app and reverse engineering

  • NodeJS PHP Golang C/CPP Java is just a language to make easy to talk with CPU/MCU.
  • Kubernetes help us to manage containerized apps.
  • VSCode help us to writing a program/apps.
  • GDB GHidra help us inspect that was built.
  • SQLi and other CWE is what hacker take benefit from other people mistake.

GitHub Statistics

Top Languages

wajs's People

Contributors

bronils avatar dependabot[bot] avatar jovazxc avatar ndunks avatar panalgin avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wajs's Issues

Trying to send image message

I am trying to send image message, I am able to upload the file but it's giving me 401 on final send command. If I can get a hint on this, I can also make a PR to this repo.

`
const imageData = fs.readFileSync('/Users/ali/Downloads/1.png');
const mediaKey = crypto.randomBytes(32);
const mediaKeyTime = Math.floor(Date.now() / 1000);
const mediaKeyExpanded = hkdf(mediaKey, 112, {info: 'WhatsApp Image Keys', hash: 'SHA-256'});

const iv = mediaKeyExpanded.slice(0, 16);
const cipherKey = mediaKeyExpanded.slice(16, 48);
const macKey = mediaKeyExpanded.slice(48, 80);

const cipher = crypto.createCipheriv('aes-256-cbc', cipherKey, iv);
let enc = cipher.update(imageData);
enc = Buffer.concat([iv, enc, cipher.final()]);

const sig = crypto.createHmac("sha256", macKey).update(Buffer.concat([iv, enc])).digest();
const mac = sig.slice(0, 10);

let sum = crypto.createHash('sha256');
sum.update(imageData);
const fileSha256 = sum.digest();

let sum2 = crypto.createHash('sha256');
sum2.update(Buffer.concat([enc, mac]));
const fileEncSha256 = sum2.digest();

const fileEncSha256B64 = fileEncSha256.toString('base64');

wa.client.ws.sendCmd('query', 'mediaConn').then(data => {
      const auth = data.media_conn.auth;
      const options = {
        hostname: 'mmg-fna.whatsapp.net',
        path: `/mms/image/${(fileEncSha256B64)}?auth=${encodeURI(auth)}&token=${(fileEncSha256B64)}`,
        method: 'POST',
        port: 443,
        headers: {
          'Origin': 'https://web.whatsapp.com',
          'Referer': 'https://web.whatsapp.com/',
        }
      };

      const req = https.request(options, resp => {
        resp.on('data', (d) => {
          const jd = JSON.parse(d)

          const webMsg = new WebMessageInfo();
          const msg = new Message();
          const key = new MessageKey();
          const msgId = createMessageId();

          key.setId(msgId);
          key.setRemotejid(widHelper.sanitizer('[email protected]'));
          key.setFromme(true);

          const imageProto = new ImageMessage();
          imageProto.setUrl(jd.url);
          imageProto.setMediakey(mediaKey.toString('base64'));
          imageProto.setMimetype('image/jpeg');
          imageProto.setFileencsha256(fileEncSha256.toString('base64'));
          imageProto.setFilesha256(fileSha256.toString('base64'));
          imageProto.setDirectpath(jd.direct_path);
          imageProto.setMediakeytimestamp(mediaKeyTime);
          imageProto.setFilelength(Buffer.byteLength(imageData));

          msg.setImagemessage(imageProto);

          webMsg.setMessage(msg);
          webMsg.setKey(key);
          webMsg.setMessagetimestamp(Math.floor(Date.now() / 1000));
          webMsg.setStatus(1);

          const buf = webMsg.serializeBinary();
          const node = wa.client.actionNode("relay", [
            ["message", undefined, buf]
          ]);

          wa.client.ws.sendNode(node, msgId, binaryOptions(METRIC.MESSAGE));

        });
      });
      req.on('error', (e) => {
        console.error('errorerrorerrorerrorerrore', e);
      });
      req.write(Buffer.concat([enc, mac]));
      req.end();
    })

`

Query Message implmentation

Hi, Im trying to get the previous chat list of a contact or group, by debugging the whatsapp web im able to see that is related to query, as below

[
    "query",
    {
        count: "50",
        epoch: "5",
        index: "7A7B3E4A12A9F5BB266B1BBDE95EDF59",
        kind: "before",
        owner: "true",
        participant: undefined,
        type: "message",
        jid: {
            server: "c.us",
            user: "919133xxxxx",
            _serialized: "[email protected]"
        }

    },
    undefined
]

so im trying to implement it but getting error as writer:writeString passed non-string/wid type:, i think because the jid is Object in my message.

Can you tell me how to proceed furthur.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.