This file is indexed.

/usr/share/doc/ruby-mapscript/examples/shp2img.rb is in ruby-mapscript 6.4.1-2.

This file is owned by root:root, with mode 0o755.

The actual contents of the file can be viewed below.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env ruby 

require "mapscript"
include Mapscript

filename = ARGV[0]

shapefile = ShapefileObj.new(filename, -1)

shapepath = File.dirname(filename)
shapename = File.basename(filename, "....")

map = MapObj.new('')
map.shapepath = shapepath
map.height = 200
map.width = 200
map.extent = shapefile.bounds

$shapetypes =
{
   MS_SHAPEFILE_POINT      => MS_LAYER_POINT,
   MS_SHAPEFILE_ARC        => MS_LAYER_LINE,
   MS_SHAPEFILE_POLYGON    => MS_LAYER_POLYGON,
   MS_SHAPEFILE_MULTIPOINT => MS_LAYER_LINE
}

layer = LayerObj.new(map)
layer.name = shapename
layer.type = $shapetypes[shapefile.type]
layer.status = MS_ON
layer.data = shapename

cls = ClassObj.new(layer)
style = StyleObj.new()
color = ColorObj.new()
color.red = 107
color.green = 158
color.blue = 160
style.color = color
cls.insertStyle(style)

#map.save(shapename+'.map')
img = map.draw
img.save(shapename+'.png')