java新建一个json 内容是[{"id":718,"nameUrl":"/group=1/group=718","name":"PN","type":"PN","remark":null,"extendAttr":"{\"ptnResource1\":3,\"ptnResource2\":1000000,\"viewObj\":1}","layer":null,"eqm":{"name":"obu","category":"OBU","type":"OBU","extendAttr":null},"ne":{"id":3,"neLabel":"jcb","ipAddress":"129.9.99.1","neType":"OTCU A","softVersion":"1.0.0.0","hardVersion":null,"operationState":1,"updateTime":"2025-03-15T03:11:30.000+00:00","communicationState":1,"comments":null,"extendProp":null,"newAddress":null},"itvData":{"itvStatItemCountList":[],"errCode":"0","allOutCurr":"-","allPower":"-"},"buckData":null,"boardState":null,"staticAllPower":"3500W","staticPortNumber":8,"staticBandWidth":"100G","dynamicAllPower":"-","dynamicAllOutCurr":"-","dynamicAllOutVolt":null,"dynamicTemperature":null,"humidity":null,"pressure":null,"pitchAngle":null,"rollAngle":null,"tiltAngle":null,"tempSensor":null,"tempLvpsA":null,"tempLvpsB":null,"tempPiuA":null,"tempPiuB":null,"insulRp":null,"insulRn":null,"det375v":null,"power375":null,"jointCurr":null}]

时间: 2025-04-10 17:44:28 浏览: 55
<think>嗯,用户让我介绍如何在Java中新建一个包含特定内容的JSON数组。首先,我需要确定用户的需求。他们可能是在开发中需要构造这样的JSON结构,可能是为了测试、数据传输或者与其他系统交互。用户提供的JSON结构看起来比较复杂,包含嵌套的对象和数组,还有一些null值。 接下来,我应该考虑用户可能使用的Java库。常用的有Jackson和Gson,这两个库都比较流行,但用户可能对其中一个更熟悉。或者,用户可能不知道选择哪个,所以需要给出两种方法的示例。同时,需要确保代码示例正确,符合JSON结构的要求。 然后,我需要解析用户提供的JSON示例,确保生成的Java对象结构与之匹配。例如,顶层是一个数组,里面有一个对象,包含id、nameUrl、name、type、remark等字段。其中extendAttr是一个字符串,但实际内容是另一个JSON对象,可能需要用Map或者自定义对象来处理。eqm字段是一个对象,包含name、category、type等。ne字段又是一个复杂的对象,itvData包含数组和其他字段,剩下的很多字段都是null或者其他简单类型。 在构建Java类时,可能需要创建多个POJO类,如TopLevel、Eqm、Ne、ItvData等。需要注意字段名称与JSON中的键匹配,以及正确处理嵌套对象和数组。对于extendAttr这种虽然是字符串但实际是JSON的情况,可能需要使用@JsonRawValue注解(在Jackson中)或者自定义序列化方式,确保输出时保留原始JSON字符串,而不是转义。 另外,用户提供的JSON中有很多null值,在Java中这些字段如果为null,序列化时可能会被忽略,但用户可能需要保留这些键,所以需要在对象映射器中配置包含null值。例如,在Jackson中使用SerializationFeature.WRITE_NULLS_AS_EMPTY或者类似的配置,或者在类中使用@JsonInclude(Include.ALWAYS)注解。 然后,编写代码示例时,需要分步骤:创建对象实例,填充数据,使用ObjectMapper或Gson进行序列化。需要注意日期格式,比如updateTime字段的格式是"2025-03-15T03:11:30.000+00:00",可能需要指定日期格式,或者在Java中使用合适的日期类型(如java.time.OffsetDateTime)。 可能还需要处理extendAttr中的嵌套JSON字符串,这在Java中可能需要手动构造,比如使用字符串拼接或者JsonNode来构建,但为了简单起见,可能直接使用字符串形式赋值,确保转义正确。 最后,需要测试代码示例是否能正确生成所需的JSON结构,检查字段是否正确,特别是嵌套部分和特殊字符是否转义正确。同时,提醒用户注意依赖库的引入,比如在Maven或Gradle中添加Jackson或Gson的依赖。 用户可能遇到的问题包括:字段名不对应导致序列化失败,日期格式不正确,嵌套对象处理不当,或者null值被忽略。因此,在回答中需要强调这些注意事项,并提供相应的解决方案,比如使用注解、配置ObjectMapper等。</think>在Java中创建该JSON结构可以使用`Jackson`或`Gson`库。以下是逐步实现的示例: 1️⃣ **添加依赖**(以Jackson为例,Maven项目): ```xml <dependency> <groupId>com.fasterxml.jackson.core</groupId> <artifactId>jackson-databind</artifactId> <version>2.13.4</version> </dependency> ``` 2️⃣ **定义Java对象结构**: ```java // 顶层对象类 public class Device { private int id; private String nameUrl; private String name; private String type; private Object remark; private String extendAttr; private Object layer; private Eqm eqm; private Ne ne; private ItvData itvData; // 其他字段省略(按JSON结构补充) // 构造函数/getter/setter } public class Eqm { private String name; private String category; private String type; private Object extendAttr; // 构造函数/getter/setter } public class Ne { private int id; private String neLabel; private String ipAddress; // 其他字段省略(按JSON结构补充) // 构造函数/getter/setter } public class ItvData { private List<?> itvStatItemCountList; private String errCode; private String allOutCurr; // 构造函数/getter/setter } ``` 3️⃣ **构建JSON对象并序列化**: ```java import com.fasterxml.jackson.databind.ObjectMapper; public class JsonBuilder { public static void main(String[] args) throws Exception { // 创建最内层对象 Eqm eqm = new Eqm("obu", "OBU", "OBU", null); Ne ne = new Ne(3, "jcb", "129.9.99.1", "OTCU A", "1.0.0.0", null, 1, "2025-03-15T03:11:30.000+00:00", 1, null, null); ItvData itvData = new ItvData(new ArrayList<>(), "0", "-", "-"); // 创建主对象 Device device = new Device(); device.setId(718); device.setNameUrl("/group=1/group=718"); device.setName("PN"); device.setType("PN"); device.setExtendAttr("{\"ptnResource1\":3,\"ptnResource2\":1000000,\"viewObj\":1}"); device.setEqm(eqm); device.setNe(ne); device.setItvData(itvData); // 设置其他字段... // 序列化为JSON数组 ObjectMapper mapper = new ObjectMapper(); String json = mapper.writerWithDefaultPrettyPrinter() .writeValueAsString(Collections.singletonList(device)); System.out.println(json); } } ``` 4️⃣ **关键注意事项**: - 对`extendAttr`字段需要保持原始JSON字符串格式 - 日期字段注意格式匹配(ISO8601格式) - 空字段建议使用`@JsonInclude(JsonInclude.Include.NON_NULL)`注解过滤 - 复杂嵌套建议使用`@JsonSerialize`进行自定义序列化 5️⃣ **输出验证**: 建议使用[JSONLint](https://jsonlint.com/)等工具验证生成的JSON格式是否正确,特别注意: - 多层嵌套结构 - 字符串中的转义字符 - null值的正确表示 如果需要更简化的实现方式,也可以直接构建`Map`结构,但推荐使用POJO方式保证类型安全。
阅读全文

相关推荐

[{"boardState":{"4-ITV":"1","5-ITV":"1","1-PMU":"1","7-ITV":"0","6-ITV":"0","BL":"1","3-BLC":"1","2-PMU":"0"},"buckData":{"tempBld":"36.00","loadStatItemCountList":[{"allBuckPower":"0"}]},"det375v":"374.08","dynamicAllOutCurr":"-","dynamicAllPower":"-","dynamicTemperature":"30.00","eqm":{"category":"OBU","name":"obu","type":"OBU"},"extendAttr":"{\"ptnResource1\":3,\"ptnResource2\":1000000,\"viewObj\":1}","humidity":"43.50","id":718,"insulRn":"0.000","insulRp":"0.000","itvData":{"itvStatItemCountList":[],"errCode":"0","allOutCurr":"-","allPower":"-"},"jointCurr":"1.001","name":"PN","nameUrl":"/group=1/group=718","ne":{"communicationState":1,"id":3,"ipAddress":"129.9.99.1","neLabel":"jcb","neType":"OTCU A","newAddress":"139.19.8.128","operationState":1,"softVersion":"1.0.0.0","updateTime":1742180835000},"pitchAngle":"10.00","power375":"374.5","pressure":"97.87","rollAngle":"-11.00","staticAllPower":"3500W","staticBandWidth":"100G","staticPortNumber":8,"tempLvpsA":"32.30","tempLvpsB":"33.98","tempPiuA":"37.64","tempPiuB":"38.50","tempSensor":"30.00","tiltAngle":"-12.00","type":"PN"},{"boardState":{"4-ITV":"1","5-ITV":"1","1-PMU":"1","7-ITV":"0","6-ITV":"0","BL":"1","3-BLC":"1","2-PMU":"0"},"buckData":{"tempBld":"36.00","loadStatItemCountList":[{"allBuckPower":"0"}]},"det375v":"374.08","dynamicAllOutCurr":"-","dynamicAllPower":"-","dynamicTemperature":"30.00","eqm":{"category":"OBU","name":"obu","type":"OBU"},"extendAttr":"{\"ptnResource1\":3,\"ptnResource2\":1000000,\"viewObj\":1}","humidity":"43.50","id":718,"insulRn":"0.000","insulRp":"0.000","itvData":{"itvStatItemCountList":[],"errCode":"0","allOutCurr":"-","allPower":"-"},"jointCurr":"1.001","name":"PN","nameUrl":"/group=1/group=718","ne":{"communicationState":1,"id":3,"ipAddress":"129.9.99.1","neLabel":"jcb","neType":"OTCU A","newAddress":"139.19.8.128","operationState":1,"softVersion":"1.0.0.0","updateTime":1742180835000},"pitchAngle":"10.00","power375":"374.5","pressure":"97.87","rollAngle":"-11.00","staticAllPower":"3500W","staticBandWidth":"100G","staticPortNumber":8,"tempLvpsA":"32.30","tempLvpsB":"33.98","tempPiuA":"37.64","tempPiuB":"38.50","tempSensor":"30.00","tiltAngle":"-12.00","type":"PN"}]我有一个这样的string,怎么给它变成一个string[],给这两条json分开

[{"id":718,"nameUrl":"/group=1/group=718","name":"PN","type":"PN","remark":null,"extendAttr":"{\"ptnResource1\":3,\"ptnResource2\":1000000,\"viewObj\":1}","layer":null,"eqm":{"name":"obu","category":"OBU","type":"OBU","extendAttr":null},"ne":{"id":3,"neLabel":"jcb","ipAddress":"129.9.99.1","neType":"OTCU A","softVersion":"1.0.0.0","hardVersion":null,"operationState":1,"updateTime":"2025-03-15T03:11:30.000+00:00","communicationState":1,"comments":null,"extendProp":null,"newAddress":"139.19.8.128"},"itvData":{"itvStatItemCountList":[{"itvOutCurr":1.01,"itvTemp":65.01,"itvPressure":101.01,"name":"4-ITV","itvOutVolt":375.0,"itvPower":"378.8"},{"itvOutCurr":1.01,"itvTemp":65.02,"itvPressure":101.02,"name":"5-ITV","itvOutVolt":375.0,"itvPower":"378.8"},{"itvOutCurr":1.01,"itvTemp":65.03,"itvPressure":101.03,"name":"6-ITV","itvOutVolt":375.0,"itvPower":"378.8"},{"itvOutCurr":1.01,"itvTemp":65.04,"itvPressure":101.04,"name":"7-ITV","itvOutVolt":375.0,"itvPower":"378.8"}],"errCode":"0","allOutCurr":"4.04","avgCurHalf":0.505,"allPower":"1515.2","allOutVolt":"375.0"},"buckData":{"tempBld":"36.00","loadStatItemCountList":[{"inCurrent":0.16,"buck1Power":0.1,"allBuckPower":"0.2","inPower":500.0,"buck2Power":0.1}]},"boardState":{"4-ITV":"1","5-ITV":"1","1-PMU":"1","7-ITV":"0","6-ITV":"0","BL":"1","3-BLC":"1","2-PMU":"0"},"staticAllPower":"3500W","staticPortNumber":8,"staticBandWidth":"100G","dynamicAllPower":"1515.2","dynamicAllOutCurr":"4.04","dynamicAllOutVolt":"375.0","dynamicTemperature":"30.00","humidity":"43.50","pressure":"97.87","pitchAngle":"10.00","rollAngle":"-11.00","tiltAngle":"-12.00","tempSensor":"30.00","tempLvpsA":"32.30","tempLvpsB":"33.98","tempPiuA":"37.64","tempPiuB":"38.50","insulRp":"0.000","insulRn":"0.000","det375v":"374.08","power375":"374.5","jointCurr":"1.001"}]java代码,我只想去掉开头的那一个[和结尾的那个]

{ "context":{ "id":"VTEX_ECC_US", "partner":"VTEX_ECC_US", "enabled":true, "locale":{ "name":"United States US", "language":"en_US", "country":"US" } }, "id":"ccdc87fe-0001-bfd5-2475-01961980afe8", "ecommOrderId":"1000000033728-01", "customerEmail":"[email protected]", "customerServiceOrderId":"1000000033728-01", "placedAt":"2025-03-26T20:55", "createdAt":"2025-04-09T07:43:06.216Z", "productLineItems":[ { "id":"fb6f9404-0001-bfd5-2475-01961980d1c0", "ecommId":"PB000007US", "orderLine":"1", "quantity":1, "product":{ "name":"moto g power 5G - 2024", "price":{ "currencyCode":"USD", "basePrice":299.99, "netPrice":169.80, "tax":21.75, "grossPrice":191.55, "totalPrice":191.55 }, "productId":"PB000007US", "productOptions":[ ] }, "warehouseId":"US2", "additionalProperties":{ "inventory_reservation_id":"1000000033728-01", "brandName":"Motorola", "quantity":"2", "parentItemIndex":"null", "manufacturerCode":"PB000007US", "eccCustomAttributes.warehouseId":"MWDC", "shippingWarehouse":"US2", "taxRate":"0.1450", "ean":"null", "fulfillmentSet":"1", "ecommSkuId":"PB000007US", "uniqueId":"1000000033728-01_10713622_0", "basePrice":"29999" }, "version":11, "shipmentEcommId":"1" }, { "id":"5a84cefe-0001-bfd5-2475-01961980d30b", "ecommId":"PB000007US-1", "orderLine":"2", "quantity":1, "product":{ "name":"moto g power 5G - 2024", "price":{ "currencyCode":"USD", "basePrice":299.99, "netPrice":169.80, "tax":21.75, "grossPrice":191.55, "totalPrice":191.55 }, "productId":"PB000007US", "productOptions":[ ] }, "warehouseId":"US2", "additionalProperties":{ "inventory_reservation_id":"1000000033728-01", "brandName":"Motorola", "quantity":"2", "parentItemIndex":"null", "manufacturerCode":"PB000007US", "eccCustomAttributes.warehouseId":"MWDC", "shippingWarehouse":"US2", "taxRate":"0.1450", "ean":"null", "fulfillmentSet":"1", "ecommSkuId":"PB000007US", "uniqueId":"1000000033728-01_10713622_0", "basePrice":"29999" }, "version":11, "shipmentEcommId":"1" }, { "id":"473be1c4-0001-bfd5-2475-01961980d1c0", "ecommId":"PG38C06068", "orderLine":"3", "quantity":1, "product":{ "name":"Moto tag Starlight Blue + Sage Green - 4 Pack", "price":{ "currencyCode":"USD", "basePrice":99.99, "netPrice":56.60, "tax":0, "grossPrice":56.60, "totalPrice":56.60 }, "productId":"PG38C06068", "productOptions":[ ] }, "warehouseId":"US2", "additionalProperties":{ "inventory_reservation_id":"1000000033728-01", "brandName":"Motorola", "quantity":"1", "parentItemIndex":"null", "manufacturerCode":"PG38C06068", "eccCustomAttributes.warehouseId":"MWDC", "shippingWarehouse":"US2", "ean":"null", "fulfillmentSet":"1", "ecommSkuId":"PG38C06068", "giftParentItemIndex":"2", "uniqueId":"1000000033728-01_10711084_1", "basePrice":"0" }, "version":11, "shipmentEcommId":"1" }, { "id":"92073f75-0001-bfd5-2475-01961980d1c0", "ecommId":"PG38C06068", "orderLine":"4", "quantity":1, "product":{ "name":"Moto tag Starlight Blue + Sage Green - 4 Pack", "price":{ "currencyCode":"USD", "basePrice":99.99, "netPrice":56.60, "tax":0, "grossPrice":56.60, "totalPrice":56.60 }, "productId":"PG38C06068", "productOptions":[ ] }, "warehouseId":"US2", "additionalProperties":{ "inventory_reservation_id":"1000000033728-01", "brandName":"Motorola", "quantity":"1", "parentItemIndex":"null", "manufacturerCode":"PG38C06068", "eccCustomAttributes.warehouseId":"MWDC", "shippingWarehouse":"US2", "ean":"null", "fulfillmentSet":"1", "ecommSkuId":"PG38C06068", "giftParentItemIndex":"1", "uniqueId":"1000000033728-01_10711084_2", "basePrice":"0" }, "version":11, "shipmentEcommId":"1" }, { "id":"edc28c36-0001-bfd5-2475-01961980d1c1", "ecommId":"PG38C05764", "orderLine":"5", "quantity":1, "product":{ "name":"moto buds+", "price":{ "currencyCode":"USD", "basePrice":129.99, "netPrice":73.59, "tax":0, "grossPrice":73.59, "totalPrice":73.59 }, "productId":"PG38C05764", "productOptions":[ ] }, "warehouseId":"US2", "additionalProperties":{ "inventory_reservation_id":"1000000033728-01", "brandName":"Motorola", "quantity":"1", "parentItemIndex":"null", "manufacturerCode":"PG38C05764", "eccCustomAttributes.warehouseId":"MWDC", "shippingWarehouse":"US2", "ean":"null", "fulfillmentSet":"1", "ecommSkuId":"PG38C05764", "giftParentItemIndex":"1", "uniqueId":"1000000033728-01_10716175_3", "basePrice":"0" }, "version":11, "shipmentEcommId":"1" }, { "id":"399ec9f6-0001-bfd5-2475-01961980d1c1", "ecommId":"PG38C05764", "orderLine":"6", "quantity":1, "product":{ "name":"moto buds+", "price":{ "currencyCode":"USD", "basePrice":129.99, "netPrice":73.59, "tax":0, "grossPrice":73.59, "totalPrice":73.59 }, "productId":"PG38C05764", "productOptions":[ ] }, "warehouseId":"US2", "additionalProperties":{ "inventory_reservation_id":"1000000033728-01", "brandName":"Motorola", "quantity":"1", "parentItemIndex":"null", "manufacturerCode":"PG38C05764", "eccCustomAttributes.warehouseId":"MWDC", "shippingWarehouse":"US2", "ean":"null", "fulfillmentSet":"1", "ecommSkuId":"PG38C05764", "giftParentItemIndex":"2", "uniqueId":"1000000033728-01_10716175_4", "basePrice":"0" }, "version":11, "shipmentEcommId":"1" } ], "shipments":[ { "id":"846a17b7-0001-bfd5-2475-01961980d1c1", "shippingAddress":{ "address1":"08588 TRI TOWNSHIP RD", "city":"NEW BREMEN", "countryCode":"US", "firstName":"Daniel", "lastName":"Henning", "postalCode":"45869-9780", "stateCode":"OH", "phone":"(419)202-0882" }, "ecommId":"1", "status":"PAID", "promiseDate":"2025-03-26T09:00:00.000Z", "scheduledShipDate":"2025-03-26T09:00:00.000Z", "shippingMethod":"Expedited US", "paymentId":"1354679991592710145", "paymentIds":[ "1354679991592710145" ], "storeFrontId":"demandware Regular Orders - US", "productLineItemIds":[ "1", "2", "3", "4", "5", "6" ], "additionalProperties":{ "motoShippingMethod":"Expedited US", "salesOffice":"US22", "adjustedTax":"0.00", "jurisdictionCode":"USOH4586997800", "stateCode":"OH", "motoScheduledShipDate":"2025-03-26T09:00:00.000Z", "adjustedGrossPrice":"0.00", "adjustedNetPrice":"0.00" }, "version":8 } ], "payments":[ { "id":"76cdfef9-0001-bfd5-2475-01961980d20e", "ecommPaymentId":"1354679991592710145", "paymentType":"CREDIT_CARD", "paymentValue":"643.48", "numberOfInstallments":"0", "billingAddress":{ "address1":"08588 TRI TOWNSHIP RD", "city":"NEW BREMEN", "companyName":"", "countryCode":"US", "firstName":"Daniel", "lastName":"Henning", "postalCode":"45869-9780", "stateCode":"OH", "phone":"(419)202-0882" }, "token":"7430225469136684004983", "additionalProperties":{ "authorize.transactionFeeAmount":"643.48", "processorId":"VTEX", "connector":"vtex-cybersource-v1", "affirmCustomAttributes.chargeId":"", "prePayment":"false", "vtexPaymentId":"1354679991592710145", "paymentBrand":"DISCOVER", "paymentId":"20250415051349468-5df5176f-0001-ba52-1193-019637de2c9c", "processorTransactionId":"", "eccCustomAttributes.paymentType":"DISCOVER", "stateCode":"OH", "paymentType":"DISCOVER" }, "version":9, "paymentObject":{ "amount":643.48, "cardHolder":"Daniel Henning", "creditCardType":"DISCOVER", "currency":"USD", "expirationMonth":"8", "expirationYear":"2025", "method":"CREDIT_CARD", "lastFourCardNumberDigits":"XXXX-XXXX-XXXX-6190" } } ], "status":"PAID", "updatedAt":"2025-04-15T05:19:54.054Z", "prefLanguage":"en_US", "partnerAttributes":{ "paymentSystem":"5", "send-status-to-big-query-SSD_HOLD":"true", "orderSource":"MOTO", "order_context":"VTEX_ECC_US", "rsaOrder":"false", "salesOrg":"US11", "originalEcommOrderId":"1000000033728-01", "accountId":"", "environment":"null", "orderReason":"", "promotions":"{id:ratesAndBenefitsData,rateAndBenefitsIdentifiers:[{description:FREETAGS,featured:false,id:397566623416323,name:FREETAGS,matchedParameters:{couponCode@Marketing:FREETAGS,buyAndWin@Marketing:PB000007US,uniqueId:1000000033728-01_10711084_1}},{description:FREETAGS,featured:false,id:397566623416323,name:FREETAGS,matchedParameters:{couponCode@Marketing:FREETAGS,buyAndWin@Marketing:PB000007US,uniqueId:1000000033728-01_10711084_2}},{description:US_bogo_cancun_flute_moto_tags,featured:false,id:400673716305921,name:US_bogo_cancun_flute_moto_tags,matchedParameters:{buyAndWin@Marketing:PB000007US,uniqueId:1000000033728-01_10716175_3}},{description:US_bogo_cancun_flute_moto_tags,featured:false,id:400673716305921,name:US_bogo_cancun_flute_moto_tags,matchedParameters:{buyAndWin@Marketing:PB000007US,uniqueId:1000000033728-01_10716175_4}}]}", "originalOrder":"{affiliateId:null,allowCancellation:true,allowEdition:false,callCenterOperatorData:{email:null,id:,userName:null},cancelReason:null,cancellationData:null,changesAttachment:null,checkedIn:false,checkedInPickupPointId:null,clientPreferencesData:null,commercialConditionData:null,commercialConditionID:1,completed:null,followUpEmail:null,giftRegistryData:null,invoiceData:null,invoicedDate:null,itemMetadata:{Items:[{AssemblyOptions:[],DetailUrl:/p/phones/moto-g/g-power-5g-gen-2/pmipmgh35m7?pn=PB000007US,Ean:null,Id:PB000007US,ImageUrl:{imageName:Moto-g-Power-5G-pdp-ecom-render-5-color-1-166ljejx1725070923332.png,imageAddress:https://p1-ofp.static.pub/medias/Moto-g-Power-5G-pdp-ecom-render-5-color-1-166ljejx1725070923332.png},Name:moto g power 5G - 2024,ProductId:PB000007US,RefId:PB000007US,Seller:B2C,SkuName:moto g power 5G - 2024},{AssemblyOptions:[],DetailUrl:/p/motoaccessories/all-moto-tags/pg38c06068,Ean:null,Id:PG38C06068,ImageUrl:{imageName:moto-tag-pdp-ecomm-render-3-kit-1725071104259.png,imageAddress:https://p1-ofp.static.pub/medias/moto-tag-pdp-ecomm-render-3-kit-1725071104259.png},Name:Moto tag Starlight Blue + Sage Green - 4 Pack,ProductId:PG38C06068,RefId:PG38C06068,Seller:B2C,SkuName:Moto tag Starlight Blue + Sage Green - 4 Pack},{AssemblyOptions:[],DetailUrl:/p/motoaccessories/all-moto-tags/pg38c06068,Ean:null,Id:PG38C06068,ImageUrl:{imageName:moto-tag-pdp-ecomm-render-3-kit-1725071104259.png,imageAddress:https://p1-ofp.static.pub/medias/moto-tag-pdp-ecomm-render-3-kit-1725071104259.png},Name:Moto tag Starlight Blue + Sage Green - 4 Pack,ProductId:PG38C06068,RefId:PG38C06068,Seller:B2C,SkuName:Moto tag Starlight Blue + Sage Green - 4 Pack},{AssemblyOptions:[],DetailUrl:/p/motoaccessories/moto-mods/pg38c05764,Ean:null,Id:PG38C05764,ImageUrl:{imageName:buds,imageAddress:https://p1-ofp.static.pub/medias/motorola-buds-plus-pdp-render-Darkest-Spruce-3-1725455173847.png},Name:moto buds+,ProductId:PG38C05764,RefId:PG38C05764,Seller:B2C,SkuName:moto buds+},{AssemblyOptions:[],DetailUrl:/p/motoaccessories/moto-mods/pg38c05764,Ean:null,Id:PG38C05764,ImageUrl:{imageName:buds,imageAddress:https://p1-ofp.static.pub/medias/motorola-buds-plus-pdp-render-Darkest-Spruce-3-1725455173847.png},Name:moto buds+,ProductId:PG38C05764,RefId:PG38C05764,Seller:B2C,SkuName:moto buds+}]},lastMessage:null,marketingData:null,marketplace:{baseURL:,isCertified:null,name:motorolas},marketplaceItems:[],marketplaceOrderId:null,merchantName:null,openTextField:null,orderId:1000000033728-01,packageAttachment:null,paymentByTransaction:[{ConnectorResponses:{Message:AUTHORIZED,ReturnCode:00,Tid:7430225469136684004983,authId:7430225469136684004983,nsu:null},ShowConnectorResponses:true,authorizationDate:2025-03-26T20:55:48,billingAddressDifferent:true,connector:vtex-cybersource-v1,custom:false,fields:[{name:currencyCode,value:USD},{name:originalPaymentSystem,value:2},{name:cardHolder,value:Daniel Henning},{name:lastDigits,value:6190},{name:expiryMonth,value:8},{name:expiryYear,value:2025},{name:paymentMethod,value:DISC},{name:tid,value:7430225469136684004983},{name:returnMessage,value:AUTHORIZED},{name:returnCode,value:00},{name:connector,value:vtex-cybersource-v1}],group:creditCard,id:1354679991592710145,installments:0,installmentsInterestRate:0,installmentsValue:64348,merchantName:null,paymentSystem:5,paymentSystemName:Discover,referenceValue:64348,self:{href:},status:Authorized,value:64348}],ratesAndBenefitsData:{id:ratesAndBenefitsData,rateAndBenefitsIdentifiers:[{additionalInfo:null,description:FREETAGS,featured:false,id:397566623416323,matchedParameters:{couponCode@Marketing:FREETAGS,buyAndWin@Marketing:PB000007US,uniqueId:1000000033728-01_10711084_1},name:FREETAGS},{additionalInfo:null,description:FREETAGS,featured:false,id:397566623416323,matchedParameters:{couponCode@Marketing:FREETAGS,buyAndWin@Marketing:PB000007US,uniqueId:1000000033728-01_10711084_2},name:FREETAGS},{additionalInfo:null,description:US_bogo_cancun_flute_moto_tags,featured:false,id:400673716305921,matchedParameters:{buyAndWin@Marketing:PB000007US,uniqueId:1000000033728-01_10716175_3},name:US_bogo_cancun_flute_moto_tags},{additionalInfo:null,description:US_bogo_cancun_flute_moto_tags,featured:false,id:400673716305921,matchedParameters:{buyAndWin@Marketing:PB000007US,uniqueId:1000000033728-01_10716175_4},name:US_bogo_cancun_flute_moto_tags}]},roundingError:null,storePreferencesData:{countryCode:US,currencyCode:USD,currencyFormatInfo:{CurrencyDecimalDigits:2,CurrencyDecimalSeparator:.,CurrencyGroupSeparator:,,CurrencyGroupSize:3,StartsWithCurrencySymbol:true},currencyLocale:0,currencySymbol:$,timeZone:Coordinated Universal Time},subscriptionData:null,taxData:null,transactionDetails:{authorizationDate:2025-03-26T20:55:48,authorizationToken:7430225469136684004983,buyer:null,channel:MOTOROLAS,chargeback:null,fields:[{name:salesChannel,value:1},{name:orderGroup,value:1000000033728-01},{name:shippingData,value:1000000033728-01},{name:clientProfileData,value:1000000033728-01},{name:shippingData,value:1000000033728-01}],id:1354679991592710145,ipAddress:null,macId:null,receiverUri:null,referenceKey:1000000033728-01,salesChannel:1,sessionId:null,shopperInteraction:ecommerce,startDate:2025-03-26T20:55:48,status:Approved,totalRefunds:0.0,transactionId:1354679991592710145,urn:null,value:64348},transactionInteractions:[],workflowIsInError:false,sequence:1000000033728-01,marketplaceServicesEndpoint:null,sellerOrderId:1000000033728-01,origin:motousb2c,salesChannel:1,status:ready-for-handling,statusDescription:ready-for-handling,value:64348,creationDate:2025-03-26T20:55:49Z,lastChange:2025-03-27T09:11:16Z,orderGroup:1000000033728-01,totals:[{alternativeTotals:[],id:Items,name:Items Total,value:105994},{alternativeTotals:[],id:Discounts,name:Discounts Total,value:-45996},{alternativeTotals:[],id:Shipping,name:Shipping Total,value:0},{alternativeTotals:[],id:Tax,name:Tax Total,value:4350},{alternativeTotals:[],id:CustomTax,name:PRODUCT TAXES,value:4350},{alternativeTotals:[],id:CustomTax,name:CO RDF FEE,value:0},{alternativeTotals:[],id:CustomTax,name:FREIGHT TAXES,value:0}],items:[{additionalInfo:{brandId:null,brandName:Motorola,categories:[],categoriesIds:null,commercialConditionId:1,dimension:null,offeringInfo:null,offeringType:null,productClusterId:null},assemblies:[],attachmentOfferings:[],attachments:[],bundleItems:[],callCenterOperator:null,commission:0,components:[],costPrice:-100,detailUrl:/p/phones/moto-g/g-power-5g-gen-2/pmipmgh35m7?pn=PB000007US,ean:null,freightCommission:0,id:PB000007US,imageUrl:{imageName:Moto-g-Power-5G-pdp-ecom-render-5-color-1-166ljejx1725070923332.png,imageAddress:https://p1-ofp.static.pub/medias/Moto-g-Power-5G-pdp-ecom-render-5-color-1-166ljejx1725070923332.png},isGift:false,itemAttachment:{content:{},name:null},listPrice:29999,lockId:1000000033728-01,manualPrice:null,measurementUnit:null,name:moto g power 5G - 2024,offerings:[],params:[],parentAssemblyBinding:null,parentItemIndex:null,preSaleDate:null,price:29999,priceDefinition:{calculatedSellingPrice:29999,sellingPrices:[{quantity:2,value:29999}],total:null},priceTags:[{identifier:null,jurisCode:USOH4586997800,jurisName:null,jurisType:null,name:TAXHUB@Product taxes,percentual:false,rate:null,rawValue:43.5,value:4350}],priceValidUntil:null,productId:PB000007US,quantity:2,refId:PB000007US,rewardValue:0,seller:B2C,sellerSku:PB000007US,sellingPrice:29999,serialNumbers:null,shippingPrice:null,tax:43.5,taxCode:,uniqueId:1000000033728-01_10713622_0,unitMultiplier:1.0},{additionalInfo:{brandId:null,brandName:Motorola,categories:[],categoriesIds:null,commercialConditionId:1,dimension:null,offeringInfo:null,offeringType:null,productClusterId:null},assemblies:[],attachmentOfferings:[],attachments:[],bundleItems:[],callCenterOperator:null,commission:0,components:[],costPrice:-100,detailUrl:/p/motoaccessories/all-moto-tags/pg38c06068,ean:null,freightCommission:0,id:PG38C06068,imageUrl:{imageName:moto-tag-pdp-ecomm-render-3-kit-1725071104259.png,imageAddress:https://p1-ofp.static.pub/medias/moto-tag-pdp-ecomm-render-3-kit-1725071104259.png},isGift:true,itemAttachment:{content:{},name:null},listPrice:9999,lockId:1000000033728-01,manualPrice:null,measurementUnit:null,name:Moto tag Starlight Blue + Sage Green - 4 Pack,offerings:[],params:[],parentAssemblyBinding:null,parentItemIndex:null,preSaleDate:null,price:0,priceDefinition:{calculatedSellingPrice:0,sellingPrices:[{quantity:1,value:0}],total:null},priceTags:[{identifier:397566623416323,jurisCode:null,jurisName:null,jurisType:null,name:DISCOUNT@MARKETPLACE,percentual:false,rate:null,rawValue:-99.99,value:-9999}],priceValidUntil:null,productId:PG38C06068,quantity:1,refId:PG38C06068,rewardValue:0,seller:B2C,sellerSku:PG38C06068,sellingPrice:0,serialNumbers:null,shippingPrice:null,tax:0.0,taxCode:,uniqueId:1000000033728-01_10711084_1,unitMultiplier:1.0},{additionalInfo:{brandId:null,brandName:Motorola,categories:[],categoriesIds:null,commercialConditionId:1,dimension:null,offeringInfo:null,offeringType:null,productClusterId:null},assemblies:[],attachmentOfferings:[],attachments:[],bundleItems:[],callCenterOperator:null,commission:0,components:[],costPrice:-100,detailUrl:/p/motoaccessories/all-moto-tags/pg38c06068,ean:null,freightCommission:0,id:PG38C06068,imageUrl:{imageName:moto-tag-pdp-ecomm-render-3-kit-1725071104259.png,imageAddress:https://p1-ofp.static.pub/medias/moto-tag-pdp-ecomm-render-3-kit-1725071104259.png},isGift:true,itemAttachment:{content:{},name:null},listPrice:9999,lockId:1000000033728-01,manualPrice:null,measurementUnit:null,name:Moto tag Starlight Blue + Sage Green - 4 Pack,offerings:[],params:[],parentAssemblyBinding:null,parentItemIndex:null,preSaleDate:null,price:0,priceDefinition:{calculatedSellingPrice:0,sellingPrices:[{quantity:1,value:0}],total:null},priceTags:[{identifier:397566623416323,jurisCode:null,jurisName:null,jurisType:null,name:DISCOUNT@MARKETPLACE,percentual:false,rate:null,rawValue:-99.99,value:-9999}],priceValidUntil:null,productId:PG38C06068,quantity:1,refId:PG38C06068,rewardValue:0,seller:B2C,sellerSku:PG38C06068,sellingPrice:0,serialNumbers:null,shippingPrice:null,tax:0.0,taxCode:,uniqueId:1000000033728-01_10711084_2,unitMultiplier:1.0},{additionalInfo:{brandId:null,brandName:Motorola,categories:[],categoriesIds:null,commercialConditionId:1,dimension:null,offeringInfo:null,offeringType:null,productClusterId:null},assemblies:[],attachmentOfferings:[],attachments:[],bundleItems:[],callCenterOperator:null,commission:0,components:[],costPrice:-100,detailUrl:/p/motoaccessories/moto-mods/pg38c05764,ean:null,freightCommission:0,id:PG38C05764,imageUrl:{imageName:buds,imageAddress:https://p1-ofp.static.pub/medias/motorola-buds-plus-pdp-render-Darkest-Spruce-3-1725455173847.png},isGift:true,itemAttachment:{content:{},name:null},listPrice:12999,lockId:1000000033728-01,manualPrice:null,measurementUnit:null,name:moto buds+,offerings:[],params:[],parentAssemblyBinding:null,parentItemIndex:null,preSaleDate:null,price:0,priceDefinition:{calculatedSellingPrice:0,sellingPrices:[{quantity:1,value:0}],total:null},priceTags:[{identifier:400673716305921,jurisCode:null,jurisName:null,jurisType:null,name:DISCOUNT@MARKETPLACE,percentual:false,rate:null,rawValue:-129.99,value:-12999}],priceValidUntil:null,productId:PG38C05764,quantity:1,refId:PG38C05764,rewardValue:0,seller:B2C,sellerSku:PG38C05764,sellingPrice:0,serialNumbers:null,shippingPrice:null,tax:0.0,taxCode:,uniqueId:1000000033728-01_10716175_3,unitMultiplier:1.0},{additionalInfo:{brandId:null,brandName:Motorola,categories:[],categoriesIds:null,commercialConditionId:1,dimension:null,offeringInfo:null,offeringType:null,productClusterId:null},assemblies:[],attachmentOfferings:[],attachments:[],bundleItems:[],callCenterOperator:null,commission:0,components:[],costPrice:-100,detailUrl:/p/motoaccessories/moto-mods/pg38c05764,ean:null,freightCommission:0,id:PG38C05764,imageUrl:{imageName:buds,imageAddress:https://p1-ofp.static.pub/medias/motorola-buds-plus-pdp-render-Darkest-Spruce-3-1725455173847.png},isGift:true,itemAttachment:{content:{},name:null},listPrice:12999,lockId:1000000033728-01,manualPrice:null,measurementUnit:null,name:moto buds+,offerings:[],params:[],parentAssemblyBinding:null,parentItemIndex:null,preSaleDate:null,price:0,priceDefinition:{calculatedSellingPrice:0,sellingPrices:[{quantity:1,value:0}],total:null},priceTags:[{identifier:400673716305921,jurisCode:null,jurisName:null,jurisType:null,name:DISCOUNT@MARKETPLACE,percentual:false,rate:null,rawValue:-129.99,value:-12999}],priceValidUntil:null,productId:PG38C05764,quantity:1,refId:PG38C05764,rewardValue:0,seller:B2C,sellerSku:PG38C05764,sellingPrice:0,serialNumbers:null,shippingPrice:null,tax:0.0,taxCode:,uniqueId:1000000033728-01_10716175_4,unitMultiplier:1.0}],clientProfileData:{corporate:false,corporateDocument:null,corporateName:null,corporatePhone:null,customerClass:null,document:null,documentType:null,email:[email protected],firstName:Daniel,id:clientProfileData,lastName:Henning,phone:(419)202-0882,stateInscription:null,tradeName:null,userProfileId:2.+YoVeJBfiv1,userProfileVersion:null},shippingData:{address:{addressId:null,addressType:residential,city:NEW BREMEN,complement:null,country:US,entityId:null,firstName:Daniel,geoCoordinates:null,jurisCode:USOH4586997800,lastName:Henning,neighborhood:null,number:null,postalCode:45869-9780,receiverName:null,reference:null,state:OH,street:08588 TRI TOWNSHIP RD,versionId:null},id:shippingData,logisticsInfo:[{addressId:null,deliveryChannel:delivery,deliveryChannels:[{id:delivery,stockBalance:0}],deliveryCompany:Expedited US,deliveryIds:[{accountCarrierName:motorolaus,courierId:Expedited US,courierName:Expedited US,dockId:,kitItemDetails:[],quantity:2,warehouseId:U404}],entityId:null,itemId:PB000007US,itemIndex:0,listPrice:0,pickupPointId:null,pickupStoreInfo:{additionalInfo:null,address:null,dockId:null,friendlyName:null,pickupStore:false},polygonName:null,price:0,selectedSla:Expedited US,sellingPrice:0,shippingEstimate:null,shippingEstimateDate:2025-03-26T09:00:00Z,shipsTo:[US],slas:[{deliveryChannel:delivery,deliveryWindow:null,id:Expedited US,lockTTL:,name:Expedited US,pickupDistance:0.0,pickupPointId:null,pickupStoreInfo:{additionalInfo:null,address:null,dockId:null,friendlyName:null,pickupStore:false},polygonName:null,price:0,shippingEstimate:,transitTime:}],transitTime:null,versionId:null},{addressId:null,deliveryChannel:delivery,deliveryChannels:[{id:delivery,stockBalance:0}],deliveryCompany:Expedited US,deliveryIds:[{accountCarrierName:motorolaus,courierId:Expedited US,courierName:Expedited US,dockId:,kitItemDetails:[],quantity:1,warehouseId:U404}],entityId:null,itemId:PG38C06068,itemIndex:1,listPrice:0,pickupPointId:null,pickupStoreInfo:{additionalInfo:null,address:null,dockId:null,friendlyName:null,pickupStore:false},polygonName:null,price:0,selectedSla:Expedited US,sellingPrice:0,shippingEstimate:null,shippingEstimateDate:2025-03-26T09:00:00Z,shipsTo:[US],slas:[{deliveryChannel:delivery,deliveryWindow:null,id:Expedited US,lockTTL:,name:Expedited US,pickupDistance:0.0,pickupPointId:null,pickupStoreInfo:{additionalInfo:null,address:null,dockId:null,friendlyName:null,pickupStore:false},polygonName:null,price:0,shippingEstimate:,transitTime:}],transitTime:null,versionId:null},{addressId:null,deliveryChannel:delivery,deliveryChannels:[{id:delivery,stockBalance:0}],deliveryCompany:Expedited US,deliveryIds:[{accountCarrierName:motorolaus,courierId:Expedited US,courierName:Expedited US,dockId:,kitItemDetails:[],quantity:1,warehouseId:U404}],entityId:null,itemId:PG38C06068,itemIndex:2,listPrice:0,pickupPointId:null,pickupStoreInfo:{additionalInfo:null,address:null,dockId:null,friendlyName:null,pickupStore:false},polygonName:null,price:0,selectedSla:Expedited US,sellingPrice:0,shippingEstimate:null,shippingEstimateDate:2025-03-26T09:00:00Z,shipsTo:[US],slas:[{deliveryChannel:delivery,deliveryWindow:null,id:Expedited US,lockTTL:,name:Expedited US,pickupDistance:0.0,pickupPointId:null,pickupStoreInfo:{additionalInfo:null,address:null,dockId:null,friendlyName:null,pickupStore:false},polygonName:null,price:0,shippingEstimate:,transitTime:}],transitTime:null,versionId:null},{addressId:null,deliveryChannel:delivery,deliveryChannels:[{id:delivery,stockBalance:0}],deliveryCompany:Expedited US,deliveryIds:[{accountCarrierName:motorolaus,courierId:Expedited US,courierName:Expedited US,dockId:,kitItemDetails:[],quantity:1,warehouseId:U404}],entityId:null,itemId:PG38C05764,itemIndex:3,listPrice:0,pickupPointId:null,pickupStoreInfo:{additionalInfo:null,address:null,dockId:null,friendlyName:null,pickupStore:false},polygonName:null,price:0,selectedSla:Expedited US,sellingPrice:0,shippingEstimate:null,shippingEstimateDate:2025-03-26T09:00:00Z,shipsTo:[US],slas:[{deliveryChannel:delivery,deliveryWindow:null,id:Expedited US,lockTTL:,name:Expedited US,pickupDistance:0.0,pickupPointId:null,pickupStoreInfo:{additionalInfo:null,address:null,dockId:null,friendlyName:null,pickupStore:false},polygonName:null,price:0,shippingEstimate:,transitTime:}],transitTime:null,versionId:null},{addressId:null,deliveryChannel:delivery,deliveryChannels:[{id:delivery,stockBalance:0}],deliveryCompany:Expedited US,deliveryIds:[{accountCarrierName:motorolaus,courierId:Expedited US,courierName:Expedited US,dockId:,kitItemDetails:[],quantity:1,warehouseId:U404}],entityId:null,itemId:PG38C05764,itemIndex:4,listPrice:0,pickupPointId:null,pickupStoreInfo:{additionalInfo:null,address:null,dockId:null,friendlyName:null,pickupStore:false},polygonName:null,price:0,selectedSla:Expedited US,sellingPrice:0,shippingEstimate:null,shippingEstimateDate:2025-03-26T09:00:00Z,shipsTo:[US],slas:[{deliveryChannel:delivery,deliveryWindow:null,id:Expedited US,lockTTL:,name:Expedited US,pickupDistance:0.0,pickupPointId:null,pickupStoreInfo:{additionalInfo:null,address:null,dockId:null,friendlyName:null,pickupStore:false},polygonName:null,price:0,shippingEstimate:,transitTime:}],transitTime:null,versionId:null}],selectedAddresses:[{addressId:null,addressType:residential,city:NEW BREMEN,complement:null,country:US,entityId:null,firstName:Daniel,geoCoordinates:null,jurisCode:USOH4586997800,lastName:Henning,neighborhood:null,number:null,postalCode:45869-9780,receiverName:null,reference:null,state:OH,street:08588 TRI TOWNSHIP RD,versionId:null}],trackingHints:null},paymentData:{transactions:[{isActive:true,merchantName:,payments:[{accountId:null,bankIssuedInvoiceBarCodeNumber:null,bankIssuedInvoiceBarCodeType:null,bankIssuedInvoiceIdentificationNumber:null,bankIssuedInvoiceIdentificationNumberFormatted:null,billingAddress:{addressId:null,addressType:null,city:NEW BREMEN,complement:null,country:US,entityId:null,firstName:Daniel,geoCoordinates:null,jurisCode:null,lastName:Henning,neighborhood:null,number:null,postalCode:45869-9780,receiverName:null,reference:null,state:OH,street:08588 TRI TOWNSHIP RD,versionId:null},cardHolder:Daniel Henning,cardNumber:xxxxxxxxxxxx6190,connectorResponses:null,cvv2:null,dueDate:null,expireMonth:8,expireYear:2025,firstDigits:null,giftCardAsDiscount:null,giftCardCaption:null,giftCardId:null,giftCardName:null,giftCardProvider:null,group:creditCard,id:1354679991592710145,installments:0,koinUrl:null,lastDigits:null,parentAccountId:null,paymentOrigin:null,paymentSystem:5,paymentSystemName:Discover,redemptionCode:null,referenceValue:64348,tid:7430225469136684004983,value:64348}],transactionId:1354679991592710145}]},sellers:[{fulfillmentEndpoint:null,id:motousb2c,logo:null,name:US Public Store}],customData:{customApps:[{fields:{mixedorder:n},id:tradeincart,major:1}]},orderFormId:null,authorizedDate:2025-03-26T20:55:48,hostname:motousb2c}", "send-status-to-big-query-CHECK_PREPAID":"true", "send-status-to-big-query-PAID":"true", "isFlashOrder":"true", "send-status-to-big-query-ORDER_RECEIVED":"true", "send-status-to-big-query-OPEN":"true", "discountCoupon2":"FREETAGS", "discountCoupon1":"FREETAGS", "send-status-to-big-query-PAYMENT_CHECK":"true", "send-status-to-big-query-RETRIEVE_DATA":"true" }, "totals":{ "totalAmount":"643.48", "totalMerchandiseCost":"599.98", "totalMerchandiseTax":"43.50", "totalShipping":"0.00", "totalShippingTax":"0.00", "additionalProperties":{ "netPrice":"0.00", "subTotal":"599.98", "totalDiscounts":"459.96" } }, "wfExecuted":false, "hold":false, "version":6, "updatedBy":"SendStatusToBigQueryAction.execute", "jobStatus":"completed", "actionsSuccessfullyExecuted":[ "ORDER_RECEIVED.AccessoriesVTEXOrderAdapterAction", "ORDER_RECEIVED.PostOrderToRsaAction", "ORDER_RECEIVED.FlashPaymentAdapterAction", "ORDER_RECEIVED.VTEXFraudAddressCheckAction", "ORDER_RECEIVED.TradeInBadOrderCheckAction", "ORDER_RECEIVED.AccessoriesAdapterOrderAction", "FlashGeolinkAddressOverrideV2ActionShipping", "FlashMotocareAction", "ORDER_RECEIVED.FlashBogoOrderAction", "VTEXCreatePaymentAction", "OPEN.OpsOrderRevenueDashboardAction", "OPEN.ECCAdapterAction", "CHECK_PREPAID.EvaluateJsonPathAction" ] }基于这个json生成一个Java对象

import re import os import json masscan_path = "D:/0.脚本小子/Tools/masscan/masscan.exe" masscan_parser_path = "../Tools/Masscan-to-CSV/masscan_xml_parser.py" nmap_parser_path = "../Tools/Nmap-Scan-to-CSV/nmap_xml_parser.py" port_list_path = "./dict/ports-http-iamthefrogy.txt" port_list_fp = open(port_list_path, "r") port_list = port_list_fp.readline().strip() port_list_fp.close() # 判断IP是否符合规范 def check_ip(data): ip_pattern = re.compile(r'((2(5[0-5]|[0-4]\d))|[0-1]?\d{1,2})(\.((2(5[0 - 5] | [0 - 4]\d)) | [0 - 1]?\d{1, 2})){3}') result = ip_pattern.match(data) if result is None: return None else: return result.group(0) def filter_ip(): ip_filepath = "./result/ip.txt" # IP数据保存路径 ip_fp = open(ip_filepath, 'r') ip_list = ip_fp.readlines() ip_fp.close() ip_fp = open(ip_filepath, 'w') for ip in ip_list: ip = check_ip(ip) if ip is not None: ip_fp.write(ip + '\n') ip_fp.close() # NMap: csv -> json,提取IP和端口的映射 def read_nmap(data_name): ip2port = {} for item in open("./result/nmap/" + data_name + '.csv'): if item.count(',') > 5: ip = item.strip().split(',')[0] port = item.strip().split(',')[4] if ip != "IP": if ip in ip2port.keys(): ip2port[ip].append(port) else: ip2port[ip] = [port] with open("./result/nmap/" + data_name + '.json', "w") as json_fp: json.dump(ip2port, json_fp) # 执行nmap命令将数据保存为xml与csv格式 def nmap(save_name, need_scan=True): if need_scan: cmd = "nmap -Pn -p {} -oX {} -iL {}".format(port_list, "./result/nmap/" + save_name + ".xml", "./result/ip.txt") os.system(cmd) cmd = "python3 {} -f {} -csv {}".format( nmap_parser_path, "./result/nmap/" + save_name + ".xml", "./result/nmap/" + save_name + ".csv" ) os.system(cmd) read_nmap(save_name) # Masscan: csv -> json,提取IP和端口的映射 def read_masscan(data_name): ip2port = {} for item in open("./result/masscan/" + data_name + '.csv'): if item.count(',') > 5: ip = item.strip().split(',')[0] port = item.strip().split(',')[3] if ip != "IpAddr": if ip in ip2port.keys(): ip2port[ip].append(port) else: ip2port[ip] = [port] with open("./result/masscan/" + data_name + '.json', "w") as json_fp: json.dump(ip2port, json_fp) # 执行masscan命令将数据保存为xml与csv格式 def masscan(save_name, need_scan=True): if need_scan: cmd = "{} -iL {} -Pn -p {} -oX {}".format( masscan_path, "./result/ip.txt", port_list, "./result/masscan/" + save_name + ".xml" ) os.system(cmd) cmd = "python3 {} -f {} -csv {}".format( masscan_parser_path, "./result/masscan/" + save_name + ".xml", "./result/masscan/" + save_name + ".csv" ) os.system(cmd) read_masscan(save_name) # 端口探测主函数 def search_port(conf, filename): filter_ip() if conf['use_nmap']: nmap(filename) if conf['use_masscan']: masscan(filename) if __name__ == '__main__': filter_ip() fp = open("./config.json", "r", encoding="utf-8") conf_json = json.load(fp) config = conf_json['ports'] search_port(config, '2023_1_8')

大家在看

recommend-type

MATALB降雨与地面径流相关性分析+三变数相关性分析(源代码+数据)

问题描述; 1.根据水量平衡的计算表格,先计算逐日土壤含水量,作为Pa估算值,再绘制降雨径流相关图 2.其如果能够绘制出相关图,请用一场洪水验证降雨径流相关图的模拟结果 3.如果不能绘制出相关图,请给出实际散点,说明相关性差的原因 3.三变数相关图制作 多场洪水(Pj,Rj)点绘于坐标图上 标明各点Pa值;绘制Pa等值线簇
recommend-type

MarkdownEditor精简绿色版

MarkdownEditor精简绿色版
recommend-type

LCD液晶知识 驱动 特点 制作过程

LCD特点 时序控制 防静电方法 驱动波形: 根据此电信号,笔段波形不是与公用波形同相就是反相。同相时液晶上无电场,LCD处于非选通状态。反相时,液晶上施加了一矩形波。当矩形波的电压比液晶阈值高很多时,LCD处于选通状态。
recommend-type

matlab source code of GA for urban intersections green wave control

The code is developed when I was study for my Ph.D. degree in Tongji Universtiy. It wiil be used to solve the green wave control problem of urban intersections, wish you can understand the content of my code. CRChang
recommend-type

pd型迭代算法附matlab代码.zip.zip

1.版本:matlab2014/2019a,内含运行结果,不会运行可私信 2.领域:智能优化算法、神经网络预测、信号处理、元胞自动机、图像处理、路径规划、无人机等多种领域的Matlab仿真,更多内容可点击博主头像 3.内容:标题所示,对于介绍可点击主页搜索博客 4.适合人群:本科,硕士等教研学习使用 5.博客介绍:热爱科研的Matlab仿真开发者,修心和技术同步精进,matlab项目合作可si信

最新推荐

recommend-type

第四章数控加工中心操作编程练习题.doc

第四章数控加工中心操作编程练习题.doc
recommend-type

互联网经济对高中生消费影响分析.docx

互联网经济对高中生消费影响分析.docx
recommend-type

南开大学2021年9月《DirectX程序设计》作业考核试题及答案参考15.docx

南开大学2021年9月《DirectX程序设计》作业考核试题及答案参考15.docx
recommend-type

浅谈中等职业教育中的计算机教学-教学方法.docx

浅谈中等职业教育中的计算机教学-教学方法.docx
recommend-type

吉林大学2021年9月《计算机系统结构》作业考核试题及答案参考12.docx

吉林大学2021年9月《计算机系统结构》作业考核试题及答案参考12.docx
recommend-type

全面解析SOAP库包功能与应用

从给定的文件信息中,我们可以提取到的核心知识点主要集中在“SOAP”这一项技术上,由于提供的信息量有限,这里将尽可能详细地解释SOAP相关的知识。 首先,SOAP代表简单对象访问协议(Simple Object Access Protocol),是一种基于XML的消息传递协议。它主要用于在网络上不同应用程序之间的通信。SOAP定义了如何通过HTTP和XML格式来构造消息,并规定了消息的格式应遵循XML模式。这种消息格式使得两个不同平台或不同编程语言的应用程序之间能够进行松耦合的服务交互。 在分布式计算环境中,SOAP作为一种中间件技术,可以被看作是应用程序之间的一种远程过程调用(RPC)机制。它通常与Web服务结合使用,Web服务是使用特定标准实现的软件系统,它公开了可以通过网络(通常是互联网)访问的API。当客户端与服务端通过SOAP进行通信时,客户端可以调用服务端上特定的方法,而不需要关心该服务是如何实现的,或者是运行在什么类型的服务器上。 SOAP协议的特点主要包括: 1. **平台无关性**:SOAP基于XML,XML是一种跨平台的标准化数据格式,因此SOAP能够跨越不同的操作系统和编程语言平台进行通信。 2. **HTTP协议绑定**:虽然SOAP协议本身独立于传输协议,但是它通常与HTTP协议绑定,这使得SOAP能够利用HTTP的普及性和无需额外配置的优势。 3. **消息模型**:SOAP消息是交换信息的载体,遵循严格的结构,包含三个主要部分:信封(Envelope)、标题(Header)和正文(Body)。信封是消息的外壳,定义了消息的开始和结束;标题可以包含各种可选属性,如安全性信息;正文则是实际的消息内容。 4. **错误处理**:SOAP提供了详细的错误处理机制,可以通过错误码和错误信息来描述消息处理过程中的错误情况。 5. **安全性和事务支持**:SOAP协议可以集成各种安全性标准,如WS-Security,以确保消息传输过程中的安全性和完整性。同时,SOAP消息可以包含事务信息,以便于服务端处理事务性的业务逻辑。 在描述中提到的“所有库包”,这可能意味着包含了SOAP协议的实现、相关工具集或库等。由于信息不足,这里的“库包”具体指的是什么并不清楚,但可以理解为与SOAP相关的软件开发工具包(SDK)或框架,它们使得开发者可以更加方便地创建SOAP消息,处理SOAP请求和响应,以及实现Web服务。 至于“压缩包子文件的文件名称列表”中只有一个单词“soap”,这可能表明实际文件内容仅有一个与SOAP相关的文件,或者是一个压缩包文件的名称为“soap”。由于缺乏更详尽的文件列表,无法进一步分析其可能的内容。 综上所述,SOAP作为一种实现Web服务的技术标准,通过HTTP和XML实现系统间的通信。它支持跨平台、跨语言的服务调用,并具备强大的安全性和错误处理机制。在具体应用中,开发者可能需要用到与之相关的库包或工具集来开发和部署Web服务。
recommend-type

编程语言选择指南:为不同项目量身定制的编程语言策略

# 摘要 选择合适的编程语言对于软件项目的成功至关重要。本文首先探讨了编程语言选择的重要性,并对不同分类和特点的编程语言进行了详尽分析,重点介绍了静态与动态类型、解释型与编译型、面向对象与函数式编程语言的区别和应用场景。接着,文章根据项目需求详细讨论了如何选择适合的编程语言,包括功能需求、性能考量、开发效率和团队技能等关键因素。通过实践案例分析,本文进一步探讨了不同
recommend-type

手写vue2的插件vue-router

<think>我们正在手写一个简化版的vue-router插件,用于Vue2。主要步骤:1.定义一个类VueRouter,包含路由映射、当前路由状态等。2.实现install方法,用于Vue.use()安装插件,在install方法中:-混入beforeCreate生命周期钩子,在组件创建时初始化router。-全局注册router-view和router-link组件。3.实现路由映射:将路由配置转换为路径与组件的映射表。4.监听hashchange事件(或者使用history模式,这里以hash模式为例)来响应路由变化。5.实现router-view组件,根据当前路由渲染对应组件。6.实现
recommend-type

《软件工程:实践者的方法》第6版课件解析

根据提供的文件信息,我们可以推断出以下知识点: 1. 课程名称:“SOFTWARE ENGINEERING A practitioner's approach 6e”,表明这是关于软件工程的课程教材,第6版,针对实践者的教学方法。 2. 版本信息:由于标题中明确指出是第6版(6e),我们知道这是一系列教科书或课件的最新版本,这意味着内容已经根据最新的软件工程理论和实践进行了更新和改进。 3. 课程类型:课程是针对“practitioner”,即实践者的,这表明教材旨在教授学生如何将理论知识应用于实际工作中,注重解决实际问题和案例学习,可能包含大量的项目管理、需求分析、系统设计和测试等方面的内容。 4. 适用范围:文件描述中提到了“仅供校园内使用”,说明这个教材是专为教育机构内部学习而设计的,可能含有某些版权保护的内容,不允许未经授权的外部使用。 5. 标签:“SOFTWARE ENGINEERING A practitioner's approach 6e 软件工程”提供了关于这门课程的直接标签信息。标签不仅重复了课程名称,还强化了这是关于软件工程的知识。软件工程作为一门学科,涉及软件开发的整个生命周期,从需求收集、设计、编码、测试到维护和退役,因此课程内容可能涵盖了这些方面。 6. 文件命名:压缩包文件名“SftEng”是“SOFTWARE ENGINEERING”的缩写,表明该压缩包包含的是软件工程相关的教材或资料。 7. 关键知识点:根据标题和描述,我们可以推测课件中可能包含的知识点有: - 软件工程基础理论:包括软件工程的定义、目标、原则和软件开发生命周期的模型。 - 需求分析:学习如何获取、分析、记录和管理软件需求。 - 系统设计:涉及软件架构设计、数据库设计、界面设计等,以及如何将需求转化为设计文档。 - 实现与编码:包括编程语言的选择、代码编写规范、版本控制等。 - 测试:软件测试的原则、方法和测试用例的设计。 - 项目管理:时间管理、团队协作、风险管理、成本估算等与软件项目成功相关的管理活动。 - 质量保证:软件质量模型、质量度量和质量控制措施。 - 维护和演化:软件部署后如何进行持续维护、升级和系统退役。 - 软件工程的新兴领域:包括敏捷开发方法、DevOps、用户体验设计等现代软件开发趋势。 8. 版权和使用限制:由于是专供校园内使用的教材,课件可能包含版权声明和使用限制,要求用户在没有授权的情况下不得对外传播和用于商业用途。 综上所述,这门课程的课件是为校园内的学生和教职员工设计的,关于软件工程的全面教育材料,覆盖了理论知识和实践技巧,并且在版权方面有所限制。由于是最新版的教材,它很可能包含了最新的软件工程技术和方法论。
recommend-type

QUARTUS II 13.0全攻略:新手到专家的10个必备技能

# 摘要 本文旨在详细介绍QUARTUS II 13.0软件的使用,包括其安装、FPGA基础、项目设置、设计流程、高级功能应用