<commit_before>#!/usr/bin/env python

import socket
import sys
import struct
import os
import getopt

from ISO8583 import ISO8583, MemDump
from py8583spec import IsoSpec
 
def main(s):
    pass
    s.send(b'iddqd')
    s.close()
    print('Connection closed')
    """
    while True:
        try:
            conn, addr = s.accept()
            print ('Connected client: ' + addr[0] + ':' + str(addr[1]))
            data = conn.recv(4096)
            MemDump("Data received:", data)
            
            Len = struct.unpack_from("!H", data[:2])[0]
            
            if(Len != len(data) - 2):
                print("Invalid length {0} - {1}".format(Len, len(data) - 2))
                conn.close()
                continue
            
            IsoMessage = ISO8583(data[2:], IsoSpec1987BCD())
            
            IsoMessage.PrintMessage()
            
            IsoMessage.MTI("0210")
            
            IsoMessage.Field(39, 1)
            IsoMessage.FieldData(39, "00")
            IsoMessage.Field(2, 0)
            IsoMessage.Field(35, 0)
            IsoMessage.Field(52, 0)
            IsoMessage.Field(60, 0)
             
            print("\n\n\n")
            IsoMessage.PrintMessage()
            data = IsoMessage.BuildIso()
            data = struct.pack("!H", len(data)) + data
             
            MemDump("Sending:", data)
            conn.send(data)
            
        except KeyboardInterrupt:
            print('Exit')
            s.close()
            sys.exit()
        except Exception as ex:
            print(ex)
            
        conn.close()
    """


def show_help(name):
    """
    Show help and basic usage
    """
    print('Usage: python3 {} [OPTIONS]... '.format(name))
    print('ISO8583 message client')
    print('  -p, --port=[PORT]\t\tTCP port to connect to, 1337 by default')
    print('  -s, --server=[IP]\t\tIP of the ISO host to connect to, 127.0.0.1 by default')


if __name__ == '__main__':
    ip = '127.0.0.1'
    port = 1337

    optlist, args = getopt.getopt(sys.argv[1:], 'hp:s:', ['help', 'port=', 'server='])
    for opt, arg in optlist:
        if opt in ('-h', '--help'):
            show_help(sys.argv[0])
            sys.exit()
        elif opt in ('-p', '--port'):
            try:
                port = int(arg)
            except ValueError:
                print('Invalid TCP port: {}'.format(arg))
                sys.exit()<commit_msg>Sending dummy message from isoClient<commit_after>#!/usr/bin/env python

import socket
import sys
import struct
import os
import getopt

from ISO8583 import ISO8583, MemDump
from py8583spec import IsoSpec, IsoSpec1987BCD
 
def main(s):
    IsoMessage = ISO8583(IsoSpec=IsoSpec1987BCD())            
    IsoMessage.MTI("0210")
            
    IsoMessage.Field(39, 1)
    IsoMessage.FieldData(39, "00")
    IsoMessage.Field(2, 0)
    IsoMessage.Field(35, 0)
    IsoMessage.Field(52, 0)
    IsoMessage.Field(60, 0)

    IsoMessage.PrintMessage()

    data = IsoMessage.BuildIso()
    data = struct.pack("!H", len(data)) + data
             
    MemDump("Sending:", data)
    s.send(data)

    s.close()


def show_help(name):
    """
    Show help and basic usage
    """
    print('Usage: python3 {} [OPTIONS]... '.format(name))
    print('ISO8583 message client')
    print('  -p, --port=[PORT]\t\tTCP port to connect to, 1337 by default')
    print('  -s, --server=[IP]\t\tIP of the ISO host to connect to, 127.0.0.1 by default')


if __name__ == '__main__':
    ip = '127.0.0.1'
    port = 1337

    optlist, args = getopt.getopt(sys.argv[1:], 'hp:s:', ['help', 'port=', 'server='])
    for opt, arg in optlist:
        if opt in ('-h', '--help'):
            show_help(sys.argv[0])
            sys.exit()
        elif opt in ('-p', '--port'):
            try:
                port = int(arg)
            except ValueError:
                print('Invalid TCP port: {}'.format(arg))
                sys.exit()
{'fraction_non_alphanumeric': 0.14553752535496958, 'fraction_numerical': 0.03930020283975659, 'mean_word_length': 1.7664796633941093, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 4, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6050871', 'n_tokens_mistral': 1381, 'n_tokens_neox': 1278, 'n_words': 306}