巧解银联8583数据域
时间:2022-07-22
本文章向大家介绍巧解银联8583数据域,主要内容包括其使用实例、应用技巧、基本知识点总结和需要注意事项,具有一定的参考价值,需要的朋友可以参考一下。
仔细分析了下8583报文,发现理解之后,解析还是很方便的。
两个函数搞定。
/*
**************************************************************************************************************
*Iso8583 报文初始化
Information8583SetRcv[0] -----> 1域
Information8583SetRcv[1] -----> 2域
. .
. .
. .
Information8583SetRcv[63] ----->64域
**************************************************************************************************************
*/
void APP_8583_Init( __8583Information *Information8583Set)
{
Information8583Set[0].Seat = 0;
Information8583Set[0].LenLen = 0;
Information8583Set[0].DataLen = 0;
Information8583Set[1].Seat = 0;
Information8583Set[1].LenLen = 1;
Information8583Set[1].DataLen = 0;
Information8583Set[2].Seat = 0;
Information8583Set[2].LenLen = 0;
Information8583Set[2].DataLen = 3;
Information8583Set[3].Seat = 0;
Information8583Set[3].LenLen = 0;
Information8583Set[3].DataLen = 6;
Information8583Set[10].Seat = 0;
Information8583Set[10].LenLen = 0;
Information8583Set[10].DataLen = 3;
Information8583Set[11].Seat = 0;
Information8583Set[11].LenLen = 0;
Information8583Set[11].DataLen = 3;
Information8583Set[12].Seat = 0;
Information8583Set[12].LenLen = 0;
Information8583Set[12].DataLen = 2;
Information8583Set[13].Seat = 0;
Information8583Set[13].LenLen = 0;
Information8583Set[13].DataLen = 2;
Information8583Set[14].Seat = 0;
Information8583Set[14].LenLen = 0;
Information8583Set[14].DataLen = 2;
Information8583Set[15].Seat = 0;
Information8583Set[15].LenLen = 0;
Information8583Set[15].DataLen = 2;
Information8583Set[21].Seat = 0;
Information8583Set[21].LenLen = 0;
Information8583Set[21].DataLen = 2;
Information8583Set[22].Seat = 0;
Information8583Set[22].LenLen = 0;
Information8583Set[22].DataLen = 2;
Information8583Set[24].Seat = 0;
Information8583Set[24].LenLen = 0;
Information8583Set[24].DataLen = 1;
Information8583Set[25].Seat = 0;
Information8583Set[25].LenLen = 0;
Information8583Set[25].DataLen = 1;
Information8583Set[31].Seat = 0;
Information8583Set[31].LenLen = 1;
Information8583Set[31].DataLen = 0;
Information8583Set[36].Seat = 0;
Information8583Set[36].LenLen = 0;
Information8583Set[36].DataLen = 12;
Information8583Set[37].Seat = 0;
Information8583Set[37].LenLen = 0;
Information8583Set[37].DataLen = 6;
Information8583Set[38].Seat = 0;
Information8583Set[38].LenLen = 0;
Information8583Set[38].DataLen = 2;
Information8583Set[40].Seat = 0;
Information8583Set[40].LenLen = 0;
Information8583Set[40].DataLen = 8;
Information8583Set[41].Seat = 0;
Information8583Set[41].LenLen = 0;
Information8583Set[41].DataLen = 15;
Information8583Set[43].Seat = 0;
Information8583Set[43].LenLen = 1;
Information8583Set[43].DataLen = 0;
Information8583Set[47].Seat = 0;
Information8583Set[47].LenLen = 2;
Information8583Set[47].DataLen = 0;
Information8583Set[48].Seat = 0;
Information8583Set[48].LenLen = 0;
Information8583Set[48].DataLen = 3;
Information8583Set[51].Seat = 0;
Information8583Set[51].LenLen = 0;
Information8583Set[51].DataLen = 8;
Information8583Set[52].Seat = 0;
Information8583Set[52].LenLen = 0;
Information8583Set[52].DataLen = 8;
Information8583Set[54].Seat = 0;
Information8583Set[54].LenLen = 2;
Information8583Set[54].DataLen = 0;
Information8583Set[59].Seat = 0;
Information8583Set[59].LenLen = 2;
Information8583Set[59].DataLen = 0;
Information8583Set[60].Seat = 0;
Information8583Set[60].LenLen = 2;
Information8583Set[60].DataLen = 0;
Information8583Set[61].Seat = 0;
Information8583Set[61].LenLen = 2;
Information8583Set[61].DataLen = 0;
Information8583Set[62].Seat = 0;
Information8583Set[62].LenLen = 2;
Information8583Set[62].DataLen = 0;
Information8583Set[63].Seat = 0;
Information8583Set[63].LenLen = 0;
Information8583Set[63].DataLen = 8;
}
/*
**************************************************************************************************************
*Iso8583 报文解析
**************************************************************************************************************
*/
U32 APP_8583_Analysis( __8583Information *Information8583SetRcv, U08 *SeatBuf, U08 *DataBuf, U32 BufferLen)
{
U16 len = 0;
U08 i,rbuf[5];
U64 buf = 0,seat=1;
APP_8583_Init(Information8583SetRcv);
for(i=0;i<8;i++)
{
buf = ((buf<<8) | SeatBuf[i]);
}
len += 23;
for(i=0;i<64;i++)
{
if(buf&(seat<<(63-i)))
{
memset(rbuf, 0, 5);
if(Information8583SetRcv[i].DataLen)
{
Information8583SetRcv[i].Seat = len;
len += Information8583SetRcv[i].DataLen;
}
else
{
if(Information8583SetRcv[i].LenLen == 1)
{
sprintf((char*)rbuf,"%02X",DataBuf[len]);
Information8583SetRcv[i].DataLen = (U16)atoi((const char*)rbuf);
len += 1;
Information8583SetRcv[i].Seat = len;
if((i==1)||(i==31)||(i==47)||(i==59)||(i==60))
{
Information8583SetRcv[i].DataLen = Information8583SetRcv[i].DataLen/2 + Information8583SetRcv[i].DataLen%2;
}
}
else if(Information8583SetRcv[i].LenLen == 2)
{
sprintf((char*)rbuf,"%02X%02X", DataBuf[len], DataBuf[len+1]);
Information8583SetRcv[i].DataLen = (U16)atoi((const char*)rbuf);
len += 2;
Information8583SetRcv[i].Seat = len;
if((i==1)||(i==31)||(i==59)||(i==60)||(i==61))
{
Information8583SetRcv[i].DataLen = Information8583SetRcv[i].DataLen/2 + Information8583SetRcv[i].DataLen%2;
}
}
else
{
DEF_UPCash_Debug;
return 1;
}
len += Information8583SetRcv[i].DataLen;
}
}
}
if(len>BufferLen)
{
DEF_UPCash_Debug;
return 1;
}
return 0;
}
typedef struct { unsigned short DataLen; unsigned char LenLen; unsigned short Seat; }__8583Information;
- ElastAlert监控日志告警Web攻击行为
- Java线程使用技巧学习(二)
- 挖洞经验 | 看我如何发现“小火车托马斯”智能玩具APP聊天应用漏洞
- Hive 常见问题与技巧【Updating】
- Hive 基础(1):分区、桶、Sort Merge Bucket Join
- 简化你的 java 字符串操作:Guava 之 CharMatcher 用法简介
- WAF绕过技巧浅谈
- flask 流式响应 RuntimeError: working outside of request context
- shell 学习笔记(19)
- HBase 写优化之 BulkLoad 实现数据快速入库
- 玩转 Linux 之:由 Nginx log rotation 聊聊 mv 的妙用
- 玩转 SHELL 脚本之:linux date 知多少?
- Hive 中的 LEFT SEMI JOIN 与 JOIN ON 的前世今生
- Yaffs_guts
- JavaScript 教程
- JavaScript 编辑工具
- JavaScript 与HTML
- JavaScript 与Java
- JavaScript 数据结构
- JavaScript 基本数据类型
- JavaScript 特殊数据类型
- JavaScript 运算符
- JavaScript typeof 运算符
- JavaScript 表达式
- JavaScript 类型转换
- JavaScript 基本语法
- JavaScript 注释
- Javascript 基本处理流程
- Javascript 选择结构
- Javascript if 语句
- Javascript if 语句的嵌套
- Javascript switch 语句
- Javascript 循环结构
- Javascript 循环结构实例
- Javascript 跳转语句
- Javascript 控制语句总结
- Javascript 函数介绍
- Javascript 函数的定义
- Javascript 函数调用
- Javascript 几种特殊的函数
- JavaScript 内置函数简介
- Javascript eval() 函数
- Javascript isFinite() 函数
- Javascript isNaN() 函数
- parseInt() 与 parseFloat()
- escape() 与 unescape()
- Javascript 字符串介绍
- Javascript length属性
- javascript 字符串函数
- Javascript 日期对象简介
- Javascript 日期对象用途
- Date 对象属性和方法
- Javascript 数组是什么
- Javascript 创建数组
- Javascript 数组赋值与取值
- Javascript 数组属性和方法
- SAP Fiori Elements里Smart Link工作原理介绍
- SAP CDS view自学教程之六:如何在CDS view里消费table function
- 如何构建一个100 Gbit(无丢包)连续数据包记录器[Part3]
- 使用SAP CDS view快速创建一个Fiori应用,管理Service Order
- SAP Fiori Elements里Drop down list的实现原理
- SAP CRM销售订单UI上的字段对应的数据库表存储字段:requested start date和end date
- SAP CDS view自学教程之八:SAP Fiori Elements里不同类型的annotation
- SAP CDS view自学教程之五:如何开发支持Odata navigation的CDS view
- SAP Fiori Elements如何基于domain fixed value创建下拉菜单
- SAP WebClient UI配置决定(configuration)的逻辑介绍
- 潘石屹用Python解决100个问题 | 阶乘之和
- 潘石屹用Python解决100个问题 | 斐波那契数列分数
- Leetcode No.7 整数反转
- 后端程序员必备的 Linux 基础知识+常见命令(近万字总结)
- XSS Game分析以及知识点总结