__ __ __ __ _____ _ _ _____ _ _ _ | \/ | \ \ / / | __ \ (_) | | / ____| | | | | | \ / |_ __\ V / | |__) | __ ___ ____ _| |_ ___ | (___ | |__ ___| | | | |\/| | '__|> < | ___/ '__| \ \ / / _` | __/ _ \ \___ \| '_ \ / _ \ | | | | | | |_ / . \ | | | | | |\ V / (_| | || __/ ____) | | | | __/ | | |_| |_|_(_)_/ \_\ |_| |_| |_| \_/ \__,_|\__\___| |_____/|_| |_|\___V 2.1 if you need WebShell for Seo everyday contact me on Telegram Telegram Address : @jackleetFor_More_Tools:
# -*- coding: utf-8 -*-
#
# (c) Copyright 2003-2015 HP Development Company, L.P.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
# Author: Don Welch
#
# Std Lib
import struct
# Local
from .g import *
# DIME constants
TYPE_T_MIME = 0x01
TYPE_T_URI = 0x02
DIME_VERSION = 1
PAD_SIZE = 4
class Record(object):
def __init__(self, id, typ, typ_code, payload):
self.id = id
self.typ = typ
self.typ_code = typ_code
self.payload = payload
class Message(object):
def __init__(self):
self.records = []
def add_record(self, rec):
self.records.append(rec)
def generate(self, output): # output is a stream type
for i, r in enumerate(self.records):
log.debug("Processing record %d (%s)" % (i, r.id))
mb = me = cf = 0
if i == 0: mb = 1
if i == len(self.records)-1: me = 1
output.write(struct.pack("!B", ((DIME_VERSION & 0x1f) << 3 |
(mb & 0x01) << 2 |
(me & 0x01) << 1 |
(cf & 0x01))))
output.write(struct.pack("!B", ((r.typ_code & 0xf) << 4) & 0xf0))
output.write(struct.pack("!H", 0)) # Options length
id_len = self.bytes_needed(len(r.id))
output.write(struct.pack("!H", len(r.id))) # ID length
typ_len = self.bytes_needed(len(r.typ))
output.write(struct.pack("!H", len(r.typ))) # Type length
data_len = self.bytes_needed(len(r.payload))
output.write(struct.pack("!I", len(r.payload))) # Data length
if id_len:
output.write(struct.pack("%ds" % id_len, r.id))
if typ_len:
output.write(struct.pack("%ds" % typ_len, r.typ))
if data_len:
output.write(struct.pack("%ds" % data_len, r.payload))
def bytes_needed(self, data_len, block_size=PAD_SIZE):
if data_len % block_size == 0:
return data_len
else:
return (int(data_len/block_size+1))*block_size
if __name__ == "__main__":
log.set_level("debug")
import io
m = Message()
m.add_record(Record("cid:id0", "http://schemas.xmlsoap.org/soap/envelope/",
TYPE_T_URI, "<test>test</test>"))
m.add_record(Record("test2", "text/xml", TYPE_T_MIME, "<test>test2</test>"))
output = io.StringIO()
m.generate(output)
log.log_data(output.getvalue())
| Name | Type | Size | Permission | Actions |
|---|---|---|---|---|
| __pycache__ | Folder | 0755 |
|
|
| pexpect | Folder | 0755 |
|
|
| CdmWifi.py | File | 13.85 KB | 0644 |
|
| LedmWifi.py | File | 30.33 KB | 0644 |
|
| __init__.py | File | 826 B | 0644 |
|
| avahi.py | File | 3.01 KB | 0644 |
|
| codes.py | File | 30.63 KB | 0644 |
|
| device.py | File | 97.95 KB | 0644 |
|
| dime.py | File | 3.3 KB | 0644 |
|
| exif.py | File | 35.17 KB | 0644 |
|
| g.py | File | 14.57 KB | 0644 |
|
| imageprocessing.py | File | 35.33 KB | 0644 |
|
| imagesize.py | File | 5.75 KB | 0644 |
|
| ldif.py | File | 16.33 KB | 0644 |
|
| local.py | File | 2.36 KB | 0644 |
|
| logger.py | File | 18.06 KB | 0644 |
|
| magic.py | File | 63.2 KB | 0644 |
|
| maint.py | File | 58.36 KB | 0644 |
|
| mdns.py | File | 10.05 KB | 0644 |
|
| mfpdtf.py | File | 17.34 KB | 0644 |
|
| models.py | File | 19.16 KB | 0644 |
|
| module.py | File | 28.49 KB | 0644 |
|
| os_utils.py | File | 2.28 KB | 0644 |
|
| password.py | File | 11.43 KB | 0644 |
|
| pkit.py | File | 11.45 KB | 0644 |
|
| pml.py | File | 26.46 KB | 0644 |
|
| queues.py | File | 16.37 KB | 0644 |
|
| services.py | File | 9.74 KB | 0644 |
|
| six.py | File | 22.32 KB | 0644 |
|
| sixext.py | File | 5.78 KB | 0644 |
|
| slp.py | File | 5.8 KB | 0644 |
|
| smart_install.py | File | 11.55 KB | 0644 |
|
| status.py | File | 89.17 KB | 0644 |
|
| strings.py | File | 28.21 KB | 0644 |
|
| tui.py | File | 13.79 KB | 0644 |
|
| utils.py | File | 80.24 KB | 0644 |
|
| validation.py | File | 3.68 KB | 0644 |
|
| vcard.py | File | 43.7 KB | 0644 |
|
| wifi.py | File | 22.25 KB | 0644 |
|