Giter Site home page Giter Site logo

How to decode bplist? about go-plist HOT 3 CLOSED

ipfans avatar ipfans commented on June 30, 2024
How to decode bplist?

from go-plist.

Comments (3)

DHowett avatar DHowett commented on June 30, 2024

Interesting! Can you send (or post somewhere) the bplist? I've run a
gauntlet of test cases, but I feel like I'm breaking something somewhere.
Thanks!

-- Dustin L. Howett

On Mon, Jan 13, 2014 at 1:20 AM, ipfans [email protected] wrote:

I'm trying to write a universal bplist decode for windows by go-list.

But It seems that it doesn't work:

package main
import (
"github.com/DHowett/go-plist"
"os"
"fmt"
"io/ioutil"
"bytes"
)
func main() {
if len(os.Args) != 2 {
fmt.Println("decoder.exe [Info.plist]")
return
}
filename := os.Args[1]
filebuf,err := ioutil.ReadFile(filename)
if err != nil{
fmt.Println(err)
return
}
var bval interface{}
reader := bytes.NewReader(filebuf)
decoder := plist.NewDecoder(reader)
decoder.Decode(bval)
fmt.Println(bval)
}

bval will be nil.

Should I know the plist file content?

Such as

package main
import (
"github.com/DHowett/go-plist"
"os"
"fmt"
"io/ioutil"
"bytes"
)
func main() {
if len(os.Args) != 2 {
fmt.Println("decoder.exe [Info.plist]")
return
}
filename := os.Args[1]
filebuf,err := ioutil.ReadFile(filename)
if err != nil{
fmt.Println(err)
return
}

type sparseBundleHeader struct {
    CFBundleName        string `plist:"CFBundleName"`
    CFBundleExecuteable string `plist:"CFBundleExecuteable"`
}
var bval sparseBundleHeader
reader := bytes.NewReader(filebuf)
decoder := plist.NewDecoder(reader)
decoder.Decode(bval)
fmt.Println(bval)

}

will crash:

panic: reflect: reflect.Value.SetString using unaddressable value [recovered]
panic: interface conversion: string is not error: missing method Error


Reply to this email directly or view it on GitHubhttps://github.com//issues/2
.

from go-plist.

DHowett avatar DHowett commented on June 30, 2024

A-ha; You'll need to Decode(&bval) instead of Decode(bval)!
The output from your program with that fix:

map[DTSDKBuild:9A334 CFBundlePackageType:APPL DTCompiler:com.apple.compilers.llvm.clang.1_0 CFBundleSupportedPlatforms:[iPhoneOS] NSMainNibFile:MainWindow DTXcodeBuild:4C199 CFBundleVersion:1.0 CFBundleSignature:???? CFBundleIdentifier:com.appsec-labs.inalyzer5 CFBundleExecutable:iNalyzer MinimumOSVersion:3.0 DTSDKName:iphoneos5.0 DTPlatformName:iphoneos CFBundleName:iNalyzer5 LSRequiresIPhoneOS:true CFBundleDevelopmentRegion:English UIDeviceFamily:[1] DTPlatformBuild:9A334 DTPlatformVersion:5.0 DTXcode:0420 BuildMachineOSBuild:10K549 CFBundleDisplayName:iNalyzer5 CFBundleInfoDictionaryVersion:6.0]

from go-plist.

ipfans avatar ipfans commented on June 30, 2024

Oh, still my small mistake :)

from go-plist.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.